From: Jonathan Cameron <jic23@kernel.org>
To: Alexandru Ardelean <ardeleanalex@gmail.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
Yicong Yang <yangyicong@hisilicon.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Nuno Sa <nuno.sa@analog.com>,
Andy Shevchenko <andy.shevchenko@gmail.com>,
linux-iio <linux-iio@vger.kernel.org>,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] iio: core: Fix an error pointer vs NULL bug in devm_iio_device_alloc()
Date: Sun, 16 May 2021 10:09:36 +0100 [thread overview]
Message-ID: <20210516100936.1d733df1@jic23-huawei> (raw)
In-Reply-To: <CA+U=Dspvr4J=vRYK7ntdB2-XSLss8YutMd0YOQi4zkDr-UkxWw@mail.gmail.com>
On Sun, 16 May 2021 08:30:20 +0300
Alexandru Ardelean <ardeleanalex@gmail.com> wrote:
> On Sat, May 15, 2021 at 3:01 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> >
> > The devm_iio_device_alloc() function is supposed to return NULL and not
> > error pointers. Returning an error pointer will lead to a crash in the
> > callers.
> >
>
> oh
> that's a good catch;
>
> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders
to poke at it.
Thanks,
Jonathan
>
> > Fixes: d240dc25e3b8 ("iio: core: simplify some devm functions")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > drivers/iio/industrialio-core.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> > index bfa20a346f71..75e92bac78f3 100644
> > --- a/drivers/iio/industrialio-core.c
> > +++ b/drivers/iio/industrialio-core.c
> > @@ -1711,7 +1711,7 @@ struct iio_dev *devm_iio_device_alloc(struct device *parent, int sizeof_priv)
> > ret = devm_add_action_or_reset(parent, devm_iio_device_release,
> > iio_dev);
> > if (ret)
> > - return ERR_PTR(ret);
> > + return NULL;
> >
> > return iio_dev;
> > }
> > --
> > 2.30.2
> >
prev parent reply other threads:[~2021-05-16 9:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-15 9:56 [PATCH] iio: core: Fix an error pointer vs NULL bug in devm_iio_device_alloc() Dan Carpenter
2021-05-16 5:30 ` Alexandru Ardelean
2021-05-16 9:09 ` 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=20210516100936.1d733df1@jic23-huawei \
--to=jic23@kernel.org \
--cc=andy.shevchenko@gmail.com \
--cc=ardeleanalex@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=yangyicong@hisilicon.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