Re: [PATCH] iio: Fix uninitialized variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux