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: 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>

authored by

David Lechner and committed by
Jonathan Cameron
9e664cdd 174818e1

+1 -4
+1 -4
drivers/iio/pressure/bmp280-core.c
··· 1234 1234 s32 comp_temp; 1235 1235 u32 comp_humidity; 1236 1236 aligned_s64 timestamp; 1237 - } buffer; 1237 + } buffer = { }; /* Don't leak uninitialized stack to userspace. */ 1238 1238 int ret; 1239 - 1240 - /* Don't leak uninitialized stack to userspace. */ 1241 - memset(&buffer, 0, sizeof(buffer)); 1242 1239 1243 1240 guard(mutex)(&data->lock); 1244 1241