linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Javier Carrasco <javier.carrasco.cruz@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	"Yo-Jung (Leo) Lin" <0xff07@gmail.com>
Cc: linux-kernel-mentees@lists.linuxfoundation.org,
	ricardo@marliere.net, skhan@linuxfoundation.org,
	Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	Vasileios Amoiridis <vassilisamir@gmail.com>,
	Angel Iglesias <ang.iglesiasg@gmail.com>,
	Adam Rizkalla <ajarizzo@gmail.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	llvm@lists.linux.dev
Subject: Re: [PATCH] iio: Fix uninitialized variable
Date: Fri, 11 Oct 2024 13:02:52 +0200	[thread overview]
Message-ID: <e9f0310b-c7e7-4da4-92b5-0d2b1948c4a6@gmail.com> (raw)
In-Reply-To: <ZwkD8hXNWcL0z4Cr@smile.fi.intel.com>

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

  reply	other threads:[~2024-10-11 11:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-11  9:37 [PATCH] iio: Fix uninitialized variable Yo-Jung (Leo) Lin
2024-10-11 10:54 ` Andy Shevchenko
2024-10-11 11:02   ` Javier Carrasco [this message]
2024-10-11 11:52 ` [PATCH v2] " Yo-Jung (Leo) Lin
2024-10-11 12:31   ` Javier Carrasco
2024-10-11 15:01     ` Yo-Jung Lin
2024-10-11 18:32     ` Vasileios Aoiridis
2024-10-11 19:32       ` Javier Carrasco
2024-10-12 10:49         ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e9f0310b-c7e7-4da4-92b5-0d2b1948c4a6@gmail.com \
    --to=javier.carrasco.cruz@gmail.com \
    --cc=0xff07@gmail.com \
    --cc=ajarizzo@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=ang.iglesiasg@gmail.com \
    --cc=jic23@kernel.org \
    --cc=justinstitt@google.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=ricardo@marliere.net \
    --cc=skhan@linuxfoundation.org \
    --cc=vassilisamir@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).