Skip to content

Commit d098904

Browse files
dlechjic23
authored andcommitted
iio: pressure: bmp280: use = { } instead of memset()
Use { } instead of memset() to zero-initialize stack memory to simplify the code. Signed-off-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://patch.msgid.link/20250611-iio-zero-init-stack-with-instead-of-memset-v1-23-ebb2d0a24302@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 7d0a746 commit d098904

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

drivers/iio/pressure/bmp280-core.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,12 +1234,9 @@ static irqreturn_t bme280_trigger_handler(int irq, void *p)
12341234
s32 comp_temp;
12351235
u32 comp_humidity;
12361236
aligned_s64 timestamp;
1237-
} buffer;
1237+
} buffer = { }; /* Don't leak uninitialized stack to userspace. */
12381238
int ret;
12391239

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

12451242
/* Burst read data registers */

0 commit comments

Comments
 (0)