[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.2504170903020.18253@angie.orcam.me.uk>
Date: Thu, 17 Apr 2025 09:09:39 +0100 (BST)
From: "Maciej W. Rozycki" <macro@...am.me.uk>
To: Thorsten Blum <thorsten.blum@...ux.dev>
cc: Oleg Nesterov <oleg@...hat.com>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] MIPS: Remove unnecessary zero-length struct member
On Thu, 17 Apr 2025, Thorsten Blum wrote:
> > Also this is broken anyway: if you use MAX_REG_OFFSET for `offset' passed
> > to `regs_get_register', then data past the end of `regs' will be accessed.
>
> Yes, true. It seems like
>
> if (unlikely(offset >= MAX_REG_OFFSET))
> return 0;
>
> should do the trick.
No, other platforms use the same (offset > MAX_REG_OFFSET) check that we
do and just set MAX_REG_OFFSET correctly to point at the last register in
`struct pt_regs'.
> The comment also says "If @offset is bigger than MAX_REG_OFFSET", rather
> than "is bigger than or equal to".
And quite correctly so.
> Happy to add it to v2 or a separate patch, if this is actually correct?!
Yes, please send v2. There's no point in changing MAX_REG_OFFSET twice.
Maciej
Powered by blists - more mailing lists