Skip to content

Commit 94bb2a7

Browse files
committed
drivers: sensors: lis2dh: Fix out-of-bound access
FIX issue zephyrproject-rtos#10571 and zephyrproject-rtos#10593 atomic_xxx() functions expect the bit argument to be the position index inside the target integer and not its numerical representation (e. g. 5 means the 5th bit and not 32). The original code could potentially override an adiacent variable. Signed-off-by: Armando Visconti <[email protected]>
1 parent b928b71 commit 94bb2a7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/sensor/lis2dh/lis2dh_trigger.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
#include <misc/util.h>
88
#include <kernel.h>
99

10-
#define START_TRIG_INT1 BIT(0)
11-
#define START_TRIG_INT2 BIT(1)
12-
#define TRIGGED_INT1 BIT(4)
13-
#define TRIGGED_INT2 BIT(5)
10+
#define START_TRIG_INT1 0
11+
#define START_TRIG_INT2 1
12+
#define TRIGGED_INT1 4
13+
#define TRIGGED_INT2 5
1414

1515
#define LOG_LEVEL CONFIG_SENSOR_LOG_LEVEL
1616
#include <logging/log.h>

0 commit comments

Comments
 (0)