diff options
| author | Muhammed Sariyildiz <asiyee994@gmail.com> | 2026-08-10 22:42:47 +0100 |
|---|---|---|
| committer | Lyude Paul <lyude@redhat.com> | 2026-08-31 14:15:49 -0400 |
| commit | 7e34ab0ff3d793ffde4de699f070868f532d4b3f (patch) | |
| tree | 9d85531f976648b0d8dec4f288dd7c1f9dd110b1 /tools/perf/scripts/python | |
| parent | 47b823940e38607dad180eb2f82094ae65565a4b (diff) | |
| download | linux-7e34ab0ff3d793ffde4de699f070868f532d4b3f.tar.gz linux-7e34ab0ff3d793ffde4de699f070868f532d4b3f.zip | |
drm/nouveau/clk/gk20a: fix undefined behaviour in signed left shift
MASK(w) expands as ((1 << (w)) - 1), and GPC2CLK_OUT_SDIV14_INDIV4_MODE
is defined as plain 1. Both are used, via GPC2CLK_OUT_INIT_MASK and
GPC2CLK_OUT_INIT_VAL in gk20a_clk_prog() (and reused by gm20b, which
includes gk20a.h), to compute:
1 << 31
Left-shifting a signed int into its sign bit is undefined behaviour
per the C standard (ISO C11 6.5.7p4), and is flagged by UBSan and
static analysis tools such as cppcheck (shiftTooManyBitsSigned). Make
the shifted operand unsigned to fix it, matching the pattern used
elsewhere in the kernel for register bitfield masks.
No functional change intended.
Found via static analysis (cppcheck --enable=portability) while
auditing nvkm/subdev/clk for correctness issues.
Signed-off-by: Muhammed Sariyildiz <asiyee994@gmail.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patch.msgid.link/20260810214247.21416-1-asiyee994@gmail.com
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
