diff options
| author | Xiaomeng Tong <[email protected]> | 2022-03-27 15:58:24 +0800 |
|---|---|---|
| committer | Lyude Paul <[email protected]> | 2022-04-04 17:25:38 -0400 |
| commit | 1c3b2a27def609473ed13b1cd668cb10deab49b4 (patch) | |
| tree | 9731eb4a1d786170dc8c8b53e91118399c77de22 /tools/perf/scripts/python/exported-sql-viewer.py | |
| parent | 36fe4f24ff1f156343fab1583ea496860f8ca970 (diff) | |
drm/nouveau/clk: Fix an incorrect NULL check on list iterator
The bug is here:
if (nvkm_cstate_valid(clk, cstate, max_volt, clk->temp))
return cstate;
The list iterator value 'cstate' will *always* be set and non-NULL
by list_for_each_entry_from_reverse(), so it is incorrect to assume
that the iterator value will be unchanged if the list is empty or no
element is found (In fact, it will be a bogus pointer to an invalid
structure object containing the HEAD). Also it missed a NULL check
at callsite and may lead to invalid memory access after that.
To fix this bug, just return 'encoder' when found, otherwise return
NULL. And add the NULL check.
Cc: [email protected]
Fixes: 1f7f3d91ad38a ("drm/nouveau/clk: Respect voltage limits in nvkm_cstate_prog")
Signed-off-by: Xiaomeng Tong <[email protected]>
Reviewed-by: Lyude Paul <[email protected]>
Signed-off-by: Lyude Paul <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Diffstat (limited to 'tools/perf/scripts/python/exported-sql-viewer.py')
0 files changed, 0 insertions, 0 deletions