Skip to content

Commit

Permalink
drivers: sensors: lis2dh: Fix out-of-bound access
Browse files Browse the repository at this point in the history
FIX issue #10571 and #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 <armando.visconti@st.com>
  • Loading branch information
avisconti authored and andrewboie committed Dec 5, 2018
1 parent 067d527 commit 802ad61
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/sensor/lis2dh/lis2dh_trigger.c
Expand Up @@ -7,10 +7,10 @@
#include <misc/util.h>
#include <kernel.h>

#define START_TRIG_INT1 BIT(0)
#define START_TRIG_INT2 BIT(1)
#define TRIGGED_INT1 BIT(4)
#define TRIGGED_INT2 BIT(5)
#define START_TRIG_INT1 0
#define START_TRIG_INT2 1
#define TRIGGED_INT1 4
#define TRIGGED_INT2 5

#define LOG_LEVEL CONFIG_SENSOR_LOG_LEVEL
#include <logging/log.h>
Expand Down

0 comments on commit 802ad61

Please sign in to comment.