Messages in this thread | | | From | Javier Martinez Canillas <> | Date | Sat, 28 Jan 2023 08:22:26 +0100 | 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@chromium.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@dowhile0.org> > Cc: Liam Girdwood <lgirdwood@gmail.com> > Cc: Mark Brown <broonie@kernel.org> > Signed-off-by: Kees Cook <keescook@chromium.org> > --- > drivers/regulator/max77802-regulator.c | 34 ++++++++++++++++++--------
The patch looks good to me.
Acked-by: Javier Martinez Canillas <javierm@redhat.com>
Best regards, Javier
| |