Skip to content

Commit ff0870d

Browse files
committed
samples: boards: Fix incorrect min max range validation
Fixing the min max range validation where condtions on upper and lower bound are logically 'ANDed'. Fixing it by logical ORing the result. CID: 18325, 18326 Fixes Issue zephyrproject-rtos#9289 Fixes Issue zephyrproject-rtos#9290 Signed-off-by: Subramanian Meenakshi Sundaram <[email protected]>
1 parent a500e7e commit ff0870d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

samples/boards/nrf52/mesh/onoff_level_lighting_vnd_app/src/mesh/device_composition.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,12 +1335,12 @@ static void light_ctl_temp_range_set_unack(struct bt_mesh_model *model,
13351335
state->status_code = RANGE_SUCCESSFULLY_UPDATED;
13361336

13371337
/* This is as per 6.1.3.1 in Mesh Model Specification */
1338-
if (min < TEMP_MIN && min > TEMP_MAX) {
1338+
if (min < TEMP_MIN || min > TEMP_MAX) {
13391339
/* The provided value for Range Min cannot be set */
13401340
state->status_code = CANNOT_SET_RANGE_MIN;
13411341
}
13421342

1343-
if (max > TEMP_MAX && max < TEMP_MIN) {
1343+
if (max > TEMP_MAX || max < TEMP_MIN) {
13441344
/* The provided value for Range Max cannot be set */
13451345
state->status_code = CANNOT_SET_RANGE_MAX;
13461346
}

0 commit comments

Comments
 (0)