Skip to content

Commit 018f509

Browse files
dlechjic23
authored andcommitted
iio: bmp280: zero-init buffer
Zero-initialize the buffer used with iio_push_to_buffers_with_ts(). The struct used for the buffer has holes in it, so we need to make sure that the holes are zeroed out rather than containing uninitialized data from the stack. Reported-by: Dan Carpenter <[email protected]> Closes: https://lore.kernel.org/linux-iio/[email protected]/ Fixes: 872c801 ("iio: pressure: bmp280: drop sensor_data array") Signed-off-by: David Lechner <[email protected]> Reviewed-by: Nuno Sá <[email protected]> Link: https://patch.msgid.link/20250506-iio-pressure-bmp280-zero-init-buffer-v1-1-0935c31558ac@baylibre.com Signed-off-by: Jonathan Cameron <[email protected]>
1 parent ed7a1e8 commit 018f509

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/iio/pressure/bmp280-core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,6 +1237,9 @@ static irqreturn_t bme280_trigger_handler(int irq, void *p)
12371237
} buffer;
12381238
int ret;
12391239

1240+
/* Don't leak uninitialized stack to userspace. */
1241+
memset(&buffer, 0, sizeof(buffer));
1242+
12401243
guard(mutex)(&data->lock);
12411244

12421245
/* Burst read data registers */

0 commit comments

Comments
 (0)