Skip to contentSkip to conversation

iio: accel: adxl367: Fix uninitialized variable handled

PATCH In review Colin Ian King 2 participants 2 messages Feb 24, 2022 – Feb 26, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: accel: adxl367: Fix uninitialized variable handled

Variable handle is not initialized leading to potential garbage results with the or operations. Fix this by replacing the first or operation to an assignment to ensure handled is initialized correctly.

Fixes cbab791c5e2a ("iio: accel: add ADXL367 driver")
---
 drivers/iio/accel/adxl367.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/accel/adxl367.c +1 -1
index b452d74b1d4d..350a89b61179 100644
@@ -884,7 +884,7 @@ static irqreturn_t adxl367_irq_handler(int irq, void *private)
 	if (ret)
 		return IRQ_NONE;
 
-	handled |= adxl367_push_event(indio_dev, status);
+	handled = adxl367_push_event(indio_dev, status);
 	handled |= adxl367_push_fifo_data(indio_dev, status, fifo_entries);
 
 	return handled ? IRQ_HANDLED : IRQ_NONE;
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 7 lines · On Thu, 24 Feb 2022 21:51:49 +0000 Colin Ian King <[email protected]>…

Variable handle is not initialized leading to potential garbage results with the or operations. Fix this by replacing the first or operation to an assignment to ensure handled is initialized correctly.

Fixes cbab791c5e2a ("iio: accel: add ADXL367 driver")

Hi Colin,

Nathan's patch hit my inbox first so I applied his but added an additional Reported-by: for you to reflect you also reported it via this patch.

Thanks

Jonathan

Quoted 17 lines
---
 drivers/iio/accel/adxl367.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/accel/adxl367.c +1 -1
index b452d74b1d4d..350a89b61179 100644
@@ -884,7 +884,7 @@ static irqreturn_t adxl367_irq_handler(int irq, void *private)
 	if (ret)
 		return IRQ_NONE;
 
-	handled |= adxl367_push_event(indio_dev, status);
+	handled = adxl367_push_event(indio_dev, status);
 	handled |= adxl367_push_fifo_data(indio_dev, status, fifo_entries);
 
 	return handled ? IRQ_HANDLED : IRQ_NONE;