diff options
| author | Francesco Magazzu <postadelmaga@gmail.com> | 2026-09-18 15:16:18 +0200 |
|---|---|---|
| committer | Lyude Paul <lyude@redhat.com> | 2026-09-18 14:09:00 -0400 |
| commit | 866dbd17c3d5f599b9d93ea9bd5b3d6859ff8350 (patch) | |
| tree | 20d74f19595c214d0aff292b15d976882c89a3f0 /tools/perf/scripts/python | |
| parent | aff09d9e37e02dc60bde79035ac15b136d602259 (diff) | |
| download | linux-next-866dbd17c3d5f599b9d93ea9bd5b3d6859ff8350.tar.gz linux-next-866dbd17c3d5f599b9d93ea9bd5b3d6859ff8350.zip | |
drm/nouveau/clk: don't use the pstate cursor after the loop
nvkm_pstate_prog() walks clk->states looking for the entry at index
'pstatei' and then keeps using the list_for_each_entry cursor after the
loop. This is not triggerable today: every caller clamps the index
against clk->state_nr before calling, so the loop always breaks on a real
entry. It is safe by virtue of what the callers happen to do, not by
anything the function itself checks.
Should a caller ever pass an index that is not on the list, the cursor
would point at the list head rather than at a pstate, and the
pstate->base.domain[] and pstate->fanspeed accesses that follow would read
past it. Rather than leave that trap in place for the next caller, track
whether the entry was found and return -EINVAL if it was not.
No functional change.
Signed-off-by: Francesco Magazzu <postadelmaga@gmail.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patch.msgid.link/20260918131620.405133-3-postadelmaga@gmail.com
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
