[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e9f0310b-c7e7-4da4-92b5-0d2b1948c4a6@gmail.com>
Date: Fri, 11 Oct 2024 13:02:52 +0200
From: Javier Carrasco <javier.carrasco.cruz@...il.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
"Yo-Jung (Leo) Lin" <0xff07@...il.com>
Cc: linux-kernel-mentees@...ts.linuxfoundation.org, ricardo@...liere.net,
skhan@...uxfoundation.org, 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>,
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: Re: [PATCH] iio: Fix uninitialized variable
On 11/10/2024 12:54, Andy Shevchenko wrote:
> On Fri, Oct 11, 2024 at 05:37:45PM +0800, Yo-Jung (Leo) Lin wrote:
>> clang found that the "offset" in bmp580_trigger_handler doesn't get
>> initialized before access. Add proper initialization to this variable.
>
> ...
>
>> struct bmp280_data *data = iio_priv(indio_dev);
>> - int ret, offset;
>> + int ret, offset = 0;
>
> Can it be done closer to the actual user of it?
>
>
Actually, offset could be initialized to sizeof(32), and only used for
the temperature calculations.
+ int ret, offset = sizeof(s32);
The first memcpy would use 0 as index, as it did before.
Best regards,
Javier Carrasco
Powered by blists - more mailing lists