Skip to content

Commit 36027ee

Browse files
Mikhail Lobanovsmb49
authored andcommitted
iio: accel: bma400: Fix uninitialized variable field_value in tap event handling.
BugLink: https://bugs.launchpad.net/bugs/2097575 [ Upstream commit db9795a ] 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 <m.lobanov@rosalinux.ru> Link: https://patch.msgid.link/20240910083624.27224-1-m.lobanov@rosalinux.ru Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent e63c72e commit 36027ee

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
@@ -1219,7 +1219,8 @@ static int bma400_activity_event_en(struct bma400_data *data,
12191219
static int bma400_tap_event_en(struct bma400_data *data,
12201220
enum iio_event_direction dir, int state)
12211221
{
1222-
unsigned int mask, field_value;
1222+
unsigned int mask;
1223+
unsigned int field_value = 0;
12231224
int ret;
12241225

12251226
/*

0 commit comments

Comments
 (0)