Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 6ee2a7058fea ("iio: accel: bma400: Fix smatch warning based on use
of unintialized value.").

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 961db2da159d ("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>

authored by

Mikhail Lobanov and committed by
Jonathan Cameron
db9795a4 9852d85e

+2 -1
+2 -1
drivers/iio/accel/bma400_core.c
··· 1218 1218 static int bma400_tap_event_en(struct bma400_data *data, 1219 1219 enum iio_event_direction dir, int state) 1220 1220 { 1221 - unsigned int mask, field_value; 1221 + unsigned int mask; 1222 + unsigned int field_value = 0; 1222 1223 int ret; 1223 1224 1224 1225 /*