Skip to content

Commit db9795a

Browse files
Mikhail Lobanovjic23
authored andcommitted
iio: accel: bma400: Fix uninitialized variable field_value in tap event handling.
In the current implementation, the local variable field_value is used without prior initialization, which may lead to reading uninitialized memory. Specifically, in the macro set_mask_bits, the initial (potentially uninitialized) value of the buffer is copied into old__, and a mask is applied to calculate new__. A similar issue was resolved in commit 6ee2a70 ("iio: accel: bma400: Fix smatch warning based on use of unintialized value."). Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 961db2d ("iio: accel: bma400: Add support for single and double tap events") Signed-off-by: Mikhail Lobanov <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 9852d85 commit db9795a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/iio/accel/bma400_core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1218,7 +1218,8 @@ static int bma400_activity_event_en(struct bma400_data *data,
12181218
static int bma400_tap_event_en(struct bma400_data *data,
12191219
enum iio_event_direction dir, int state)
12201220
{
1221-
unsigned int mask, field_value;
1221+
unsigned int mask;
1222+
unsigned int field_value = 0;
12221223
int ret;
12231224

12241225
/*

0 commit comments

Comments
 (0)