From: Jonathan Cameron <jic23@kernel.org>
To: "Nuno Sá" <noname.nuno@gmail.com>
Cc: Dan Carpenter <dan.carpenter@linaro.org>,
Antoniu Miclaus <antoniu.miclaus@analog.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH next] iio: adc: ad4851: Fix signedness bug in ad4851_calibrate()
Date: Tue, 4 Mar 2025 13:13:44 +0000 [thread overview]
Message-ID: <20250304131344.65211155@jic23-huawei> (raw)
In-Reply-To: <5fa78e957fc85fa134cea5fa68b21b56c6173a44.camel@gmail.com>
On Fri, 28 Feb 2025 13:24:20 +0000
Nuno Sá <noname.nuno@gmail.com> wrote:
> On Fri, 2025-02-28 at 12:36 +0300, Dan Carpenter wrote:
> > The "c" variable is used to store error codes from ad4851_find_opt()
> > so it has to be signed for the error handling to work. Change it
> > to type int.
> >
> > Fixes: 6250803fe2ec ("iio: adc: ad4851: add ad485x driver")
> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> > ---
>
> Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Julia + 0-day / coccinelle caught this one as well but seeing as you
were both first to report and you sent me a patch I'll just apply this one.
Applied to the togreg branch of iio.git.
Thanks,
Jonathan
>
> > Btw, in ad4851_write_raw() there are some checks for negative but
> > the multiplication could still wrap and turn negative so we might want to
> > add an upper bounds as well:
> >
> > drivers/iio/adc/ad4851.c:826 ad4851_write_raw()
> > warn: potential integer overflow from user 'val * st->osr'
> >
> > drivers/iio/adc/ad4851.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/iio/adc/ad4851.c b/drivers/iio/adc/ad4851.c
> > index 1ad37084355e..98ebc853db79 100644
> > --- a/drivers/iio/adc/ad4851.c
> > +++ b/drivers/iio/adc/ad4851.c
> > @@ -492,11 +492,11 @@ static int ad4851_find_opt(const unsigned long *field,
> > unsigned int start,
> > static int ad4851_calibrate(struct iio_dev *indio_dev)
> > {
> > struct ad4851_state *st = iio_priv(indio_dev);
> > - unsigned int opt_delay, num_lanes, delay, i, s, c;
> > + unsigned int opt_delay, num_lanes, delay, i, s;
> > enum iio_backend_interface_type interface_type;
> > DECLARE_BITMAP(pn_status, AD4851_MAX_LANES * AD4851_MAX_IODELAY);
> > bool status;
> > - int ret;
> > + int c, ret;
> >
> > ret = iio_backend_interface_type_get(st->back, &interface_type);
> > if (ret)
>
>
prev parent reply other threads:[~2025-03-04 13:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-28 9:36 [PATCH next] iio: adc: ad4851: Fix signedness bug in ad4851_calibrate() Dan Carpenter
2025-02-28 13:24 ` Nuno Sá
2025-03-04 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=20250304131344.65211155@jic23-huawei \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=antoniu.miclaus@analog.com \
--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=noname.nuno@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