Skip to content

Commit

Permalink
sensing: Fix build warning on invalid array index
Browse files Browse the repository at this point in the history
The assert was verifying that the current sensor address was greater
or equal than the start of the iterable section - 1 which isn't quite
right as the start is inclusive.

Signed-off-by: Tom Burdick <[email protected]>
  • Loading branch information
teburd authored and aescolar committed Jun 7, 2024
1 parent db57c43 commit 87fc25a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion subsys/sensing/sensor_mgmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ extern "C" {
STRUCT_SECTION_END_EXTERN(sensing_sensor); \
for (struct sensing_sensor *sensor = STRUCT_SECTION_END(sensing_sensor) \
- 1; \
({ __ASSERT(sensor >= STRUCT_SECTION_START(sensing_sensor) - 1, \
({ __ASSERT(sensor >= STRUCT_SECTION_START(sensing_sensor), \
"unexpected list start location"); \
sensor >= STRUCT_SECTION_START(sensing_sensor); }); \
sensor--)
Expand Down

0 comments on commit 87fc25a

Please sign in to comment.