[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zd-g7_Cl__Z291CQ@smile.fi.intel.com>
Date: Wed, 28 Feb 2024 23:09:03 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: David Lechner <dlechner@...libre.com>
Cc: 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,
Jonathan Cameron <jic23@...nel.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 4/8] iio: core: Calculate alloc_size only once in
iio_device_alloc()
On Wed, Feb 28, 2024 at 02:57:36PM -0600, David Lechner wrote:
> On Wed, Feb 28, 2024 at 2:49 PM Andy Shevchenko
> <andriy.shevchenko@...ux.intel.com> wrote:
...
> > - alloc_size = sizeof(struct iio_dev_opaque);
> > - if (sizeof_priv) {
> > - alloc_size = ALIGN(alloc_size, IIO_DMA_MINALIGN);
> > - alloc_size += sizeof_priv;
> > - }
> > + if (sizeof_priv)
> > + alloc_size = ALIGN(alloc_size, IIO_DMA_MINALIGN) + sizeof_priv;
>
> Isn't this using alloc_size before it is assigned? Perhaps you meant this:
>
> alloc_size = ALIGN(sizeof(struct iio_dev_opaque),
> IIO_DMA_MINALIGN) + sizeof_priv;
However the end result of the series is correct, this is a good catch!
Thanks!
> > + else
> > + alloc_size = sizeof(struct iio_dev_opaque);
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists