[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABxcv=kKS8DW0SWL9FxzP6g4AVAis1P21H8d9JE1bAF7p=BugA@mail.gmail.com>
Date: Sat, 28 Jan 2023 08:22:26 +0100
From: Javier Martinez Canillas <javier@...hile0.org>
To: Kees Cook <keescook@...omium.org>
Cc: Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] regulator: max77802: Bounds check regulator id against opmode
Hello Kees,
On Fri, Jan 27, 2023 at 11:52 PM Kees Cook <keescook@...omium.org> wrote:
>
> Explicitly bounds-check the id before accessing the opmode array. Seen
> with GCC 13:
>
> ../drivers/regulator/max77802-regulator.c: In function 'max77802_enable':
> ../drivers/regulator/max77802-regulator.c:217:29: warning: array subscript [0, 41] is outside array bounds of 'unsigned int[42]' [-Warray-bounds=]
> 217 | if (max77802->opmode[id] == MAX77802_OFF_PWRREQ)
> | ~~~~~~~~~~~~~~~~^~~~
> ../drivers/regulator/max77802-regulator.c:62:22: note: while referencing 'opmode'
> 62 | unsigned int opmode[MAX77802_REG_MAX];
> | ^~~~~~
>
> Cc: Javier Martinez Canillas <javier@...hile0.org>
> Cc: Liam Girdwood <lgirdwood@...il.com>
> Cc: Mark Brown <broonie@...nel.org>
> Signed-off-by: Kees Cook <keescook@...omium.org>
> ---
> drivers/regulator/max77802-regulator.c | 34 ++++++++++++++++++--------
The patch looks good to me.
Acked-by: Javier Martinez Canillas <javierm@...hat.com>
Best regards,
Javier
Powered by blists - more mailing lists