From: Jonathan Cameron <jic23@kernel.org>
To: Vasileios Amoiridis <vassilisamir@gmail.com>
Cc: Dan Carpenter <dan.carpenter@linaro.org>,
Lars-Peter Clausen <lars@metafoo.de>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] iio: chemical: bme680: Fix uninitialized variable in __bme680_read_raw()
Date: Sun, 12 Jan 2025 13:13:13 +0000 [thread overview]
Message-ID: <20250112131313.749b58ec@jic23-huawei> (raw)
In-Reply-To: <Z37uRAl18atKgVz0@vamoirid-laptop>
On Wed, 8 Jan 2025 22:29:40 +0100
Vasileios Amoiridis <vassilisamir@gmail.com> wrote:
> On Wed, Jan 08, 2025 at 12:37:22PM +0300, Dan Carpenter wrote:
> > The bme680_read_temp() function takes a pointer to s16 but we're passing
> > an int pointer to it. This will not work on big endian systems and it
> > also means that the other 16 bits are uninitialized.
> >
> > Pass an s16 type variable.
> >
> > Fixes: f51171ce2236 ("iio: chemical: bme680: Add SCALE and RAW channels")
> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> > ---
> > drivers/iio/chemical/bme680_core.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/iio/chemical/bme680_core.c b/drivers/iio/chemical/bme680_core.c
> > index 26eb0fa77a43..9d73fd2cf52c 100644
> > --- a/drivers/iio/chemical/bme680_core.c
> > +++ b/drivers/iio/chemical/bme680_core.c
> > @@ -879,11 +879,11 @@ static int __bme680_read_raw(struct iio_dev *indio_dev,
> > case IIO_CHAN_INFO_RAW:
> > switch (chan->type) {
> > case IIO_TEMP:
> > - ret = bme680_read_temp(data, (s16 *)&chan_val);
> > + ret = bme680_read_temp(data, &temp_chan_val);
> > if (ret)
> > return ret;
> >
> > - *val = chan_val;
> > + *val = temp_chan_val;
> > return IIO_VAL_INT;
> > case IIO_PRESSURE:
> > ret = bme680_read_press(data, &chan_val);
> > --
> > 2.45.2
> >
>
> Acked-by: Vasileios Amoiridis <vassilisamir@gmail.com>
>
> Hi Dan,
>
> I had already applied this for IIO_CHAN_INFO_PROCESSED but not for the
> IIO_CHAN_INFO_RAW channel... Very good that you spotted it!
Applied to the fixes-togreg branch of iio.git and marked for stable.
Most likely will go in during the merge window or slightly after.
>
> Cheers,
> Vasilis
>
prev parent reply other threads:[~2025-01-12 13:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-08 9:37 [PATCH] iio: chemical: bme680: Fix uninitialized variable in __bme680_read_raw() Dan Carpenter
2025-01-08 21:29 ` Vasileios Amoiridis
2025-01-12 13:13 ` Jonathan Cameron [this message]
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=20250112131313.749b58ec@jic23-huawei \
--to=jic23@kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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