From: Jonathan Cameron <jic23@kernel.org>
To: "Ardelean, Alexandru" <alexandru.Ardelean@analog.com>
Cc: "navid.emamdoost@gmail.com" <navid.emamdoost@gmail.com>,
"Popa, Stefan Serban" <StefanSerban.Popa@analog.com>,
"emamd001@umn.edu" <emamd001@umn.edu>,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"knaack.h@gmx.de" <knaack.h@gmx.de>,
"Hennerich, Michael" <Michael.Hennerich@analog.com>,
"lars@metafoo.de" <lars@metafoo.de>,
"smccaman@umn.edu" <smccaman@umn.edu>,
"kjlu@umn.edu" <kjlu@umn.edu>,
"pmeerw@pmeerw.net" <pmeerw@pmeerw.net>
Subject: Re: [PATCH v2] iio: imu: adis16400: release allocated memory on failure
Date: Sat, 21 Sep 2019 19:11:33 +0100 [thread overview]
Message-ID: <20190921191133.62f12b65@archlinux> (raw)
In-Reply-To: <d4c21c74d88e542771818720e6270e4d6141b686.camel@analog.com>
On Fri, 20 Sep 2019 06:46:37 +0000
"Ardelean, Alexandru" <alexandru.Ardelean@analog.com> wrote:
> On Thu, 2019-09-19 at 10:50 -0500, Navid Emamdoost wrote:
> > In adis_update_scan_mode, if allocation for adis->buffer fails,
> > previously allocated adis->xfer needs to be released.
> >
> > v2: added adis->xfer = NULL to avoid any potential double free.
Version changes go below the --- so they don't get recorded in the
git tree log when it's applied.
>
> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Applied to the fixes-togreg branch of iio.git. Thanks,
Jonathan
>
> > Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
> > ---
> > drivers/iio/imu/adis_buffer.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/iio/imu/adis_buffer.c
> > b/drivers/iio/imu/adis_buffer.c
> > index 9ac8356d9a95..f446ff497809 100644
> > --- a/drivers/iio/imu/adis_buffer.c
> > +++ b/drivers/iio/imu/adis_buffer.c
> > @@ -78,8 +78,11 @@ int adis_update_scan_mode(struct iio_dev *indio_dev,
> > return -ENOMEM;
> >
> > adis->buffer = kcalloc(indio_dev->scan_bytes, 2, GFP_KERNEL);
> > - if (!adis->buffer)
> > + if (!adis->buffer) {
> > + kfree(adis->xfer);
> > + adis->xfer = NULL;
> > return -ENOMEM;
> > + }
> >
> > rx = adis->buffer;
> > tx = rx + scan_count;
prev parent reply other threads:[~2019-09-21 18:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-18 16:57 [PATCH] iio: imu: adis16400: release allocated memory on failure Navid Emamdoost
2019-09-19 6:51 ` Ardelean, Alexandru
2019-09-19 15:50 ` [PATCH v2] " Navid Emamdoost
2019-09-20 6:46 ` Ardelean, Alexandru
2019-09-21 18:11 ` 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=20190921191133.62f12b65@archlinux \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=StefanSerban.Popa@analog.com \
--cc=alexandru.Ardelean@analog.com \
--cc=emamd001@umn.edu \
--cc=kjlu@umn.edu \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=navid.emamdoost@gmail.com \
--cc=pmeerw@pmeerw.net \
--cc=smccaman@umn.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.