All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Lee Jones <lee@kernel.org>
Cc: Peter Tyser <ptyser@xes-inc.com>,
	Purva Yeshi <purvayeshi550@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: (subset) [PATCH] mfd: lpc_ich: Fix ARRAY_SIZE usage for apl_gpio_resources
Date: Fri, 2 May 2025 12:01:03 +0300	[thread overview]
Message-ID: <aBSJz4Nvyzh4c9AO@smile.fi.intel.com> (raw)
In-Reply-To: <20250502072732.GB3865826@google.com>

On Fri, May 02, 2025 at 08:27:32AM +0100, Lee Jones wrote:
> On Fri, 02 May 2025, Andy Shevchenko wrote:
> > Thu, May 01, 2025 at 01:07:25PM +0100, Lee Jones kirjoitti:
> > > On Thu, 24 Apr 2025, Andy Shevchenko wrote:
> > > > On Fri, Apr 04, 2025 at 02:13:08PM +0100, Lee Jones wrote:
> > > > > On Sat, 22 Mar 2025 18:48:41 +0530, Purva Yeshi wrote:

[...]

> > > > > Applied, thanks!
> > > > > 
> > > > > [1/1] mfd: lpc_ich: Fix ARRAY_SIZE usage for apl_gpio_resources
> > > > >       commit: 87e172b0fdd3aa4e3d099884e608dbc70ee3e663
> > > > 
> > > > Can this be reverted ASAP, please? See below why.
> > > > 
> > > > There is no problem with the code. The original author of the change
> > > > haven't proved otherwise.
> > > > 
> > > > The change made it much worse to read and maintain. By the way, it actually
> > > > _added_ the problem as far as I can see with my small test program.
> > > > 
> > > > Let's just calculate based on the sizeof(struct foo) taken as 10 for
> > > > simplicity and array size as 4x2. The full size of the array is
> > > > 4 * 2 * 10 bytes. The size of the entry in outer array will be 2 * 10 bytes.
> > > > Now, what ARRAY2D_SIZE do is (4 * 2 * 10 / 10 / (2 * 10 / 10) == 4, and
> > > > that's WRONG! This will make a out-of-boundary accesses possible.
> > > > 
> > > > If smatch can't parse something, it's problem of smatch. No need to "fix"
> > > > the working and robust code. The original code even allows (in theory) to have
> > > > different amount of resources per entry, however it's quite unlikely to happen.
> > > > But at bare minimum it shows the entry taken along with _its_ ARRAY_SIZE()
> > > > and not something common over the outer array.
> > > 
> > > Done.
> > 
> > I still see it as commit
> > https://web.git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git/commit/?h=for-mfd-next&id=c6c07f8ea2cbb0dca0e529f9ed16df71276515a4
> 
> -ENOPUSH
> 
> Try again.

Thanks, now it's not there.

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2025-05-02  9:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-22 13:18 [PATCH] mfd: lpc_ich: Fix ARRAY_SIZE usage for apl_gpio_resources Purva Yeshi
2025-04-04 13:13 ` (subset) " Lee Jones
2025-04-24 19:01   ` Andy Shevchenko
2025-05-01 12:07     ` Lee Jones
2025-05-02  4:35       ` Andy Shevchenko
2025-05-02  7:27         ` Lee Jones
2025-05-02  9:01           ` Andy Shevchenko [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=aBSJz4Nvyzh4c9AO@smile.fi.intel.com \
    --to=andy.shevchenko@gmail.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ptyser@xes-inc.com \
    --cc=purvayeshi550@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 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.