diff options
author | Marc Zyngier <[email protected]> | 2021-07-25 19:08:30 +0100 |
---|---|---|
committer | Linus Walleij <[email protected]> | 2021-08-10 14:47:59 +0200 |
commit | 1b73e588f47397dee6e4bdfd953e0306c60b5fe5 (patch) | |
tree | db955633b15ef5dce93a8cb17aabd6949bbc1247 /drivers/usb/cdns3/cdns3-trace.c | |
parent | a022135a19a1b2f8ee1f9e90d5d9de419543904c (diff) |
pinctrl: stmfx: Fix hazardous u8[] to unsigned long cast
Casting a small array of u8 to an unsigned long is *never* OK:
- it does funny thing when the array size is less than that of a long,
as it accesses random places in the stack
- it makes everything even more fun with a BE kernel
Fix this by building the unsigned long used as a bitmap byte by byte,
in a way that works across endianess and has no undefined behaviours.
An extra BUILD_BUG_ON() catches the unlikely case where the array
would be larger than a single unsigned long.
Fixes: 1490d9f841b1 ("pinctrl: Add STMFX GPIO expander Pinctrl/GPIO driver")
Signed-off-by: Marc Zyngier <[email protected]>
Cc: [email protected]
Cc: Amelie Delaunay <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Linus Walleij <[email protected]>
Diffstat (limited to 'drivers/usb/cdns3/cdns3-trace.c')
0 files changed, 0 insertions, 0 deletions