[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240303124624.08740a2d@jic23-huawei>
Date: Sun, 3 Mar 2024 12:46:24 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: David Lechner <dlechner@...libre.com>, Vinod Koul <vkoul@...nel.org>,
Linus Walleij <linus.walleij@...aro.org>, Jonathan Cameron
<Jonathan.Cameron@...wei.com>, Mark Brown <broonie@...nel.org>, Kees Cook
<keescook@...omium.org>, linux-arm-kernel@...ts.infradead.org,
dmaengine@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-iio@...r.kernel.org, linux-spi@...r.kernel.org,
netdev@...r.kernel.org, linux-hardening@...r.kernel.org, Lars-Peter Clausen
<lars@...afoo.de>, "David S. Miller" <davem@...emloft.net>, Eric Dumazet
<edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
<pabeni@...hat.com>, "Gustavo A. R. Silva" <gustavoars@...nel.org>
Subject: Re: [PATCH v4 3/8] iio: core: NULLify private pointer when there is
no private data
On Wed, 28 Feb 2024 23:36:43 +0200
Andy Shevchenko <andriy.shevchenko@...ux.intel.com> wrote:
> On Wed, Feb 28, 2024 at 03:06:42PM -0600, David Lechner wrote:
> > On Wed, Feb 28, 2024 at 2:50 PM Andy Shevchenko
> > <andriy.shevchenko@...ux.intel.com> wrote:
>
> ...
>
> > > - indio_dev->priv = (char *)iio_dev_opaque +
> > > - ALIGN(sizeof(struct iio_dev_opaque), IIO_DMA_MINALIGN);
> > > +
> > > + if (sizeof_priv)
> > > + indio_dev->priv = (char *)iio_dev_opaque +
> > > + ALIGN(sizeof(struct iio_dev_opaque), IIO_DMA_MINALIGN);
> > > + else
> > > + indio_dev->priv = NULL;
> >
> > Do we actually need the else branch here since we use kzalloc() and
> > therefore indio_dev->priv should already be NULL?
>
> This is more robust, but I'm okay to drop this. Up to Jonathan.
>
Given the allocation is just above here fine to drop the else in this
I think.
Powered by blists - more mailing lists