[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241011115334.367736-1-0xff07@gmail.com>
Date: Fri, 11 Oct 2024 19:52:24 +0800
From: "Yo-Jung (Leo) Lin" <0xff07@...il.com>
To:
Cc: linux-kernel-mentees@...ts.linuxfoundation.org,
ricardo@...liere.net,
skhan@...uxfoundation.org,
0xff07@...il.com,
Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Bill Wendling <morbo@...gle.com>,
Justin Stitt <justinstitt@...gle.com>,
Vasileios Amoiridis <vassilisamir@...il.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Angel Iglesias <ang.iglesiasg@...il.com>,
Adam Rizkalla <ajarizzo@...il.com>,
linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev
Subject: [PATCH v2] iio: Fix uninitialized variable
clang found that the "offset" in bmp580_trigger_handler doesn't get
initialized before access. Add proper initialization to this variable.
Signed-off-by: Yo-Jung (Leo) Lin <0xff07@...il.com>
---
Change in v2:
- Make value initialization immediate before its first use.
- Link to v1: https://lore.kernel.org/all/20241011093752.30685-1-0xff07@gmail.com/
---
drivers/iio/pressure/bmp280-core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
index f4df222ed0c3..682329f81886 100644
--- a/drivers/iio/pressure/bmp280-core.c
+++ b/drivers/iio/pressure/bmp280-core.c
@@ -2222,6 +2222,8 @@ static irqreturn_t bmp580_trigger_handler(int irq, void *p)
goto out;
}
+ offset = 0;
+
/* Pressure calculations */
memcpy(&data->sensor_data[offset], &data->buf[3], 3);
--
2.43.0
Powered by blists - more mailing lists