Commit cf92bb7
drm: nv04: Fix out of bounds access
When Output Resource (dcb->or) value is assigned in
fabricate_dcb_output(), there may be out of bounds access to
dac_users array in case dcb->or is zero because ffs(dcb->or) is
used as index there.
The 'or' argument of fabricate_dcb_output() must be interpreted as a
number of bit to set, not value.
Utilize macros from 'enum nouveau_or' in calls instead of hardcoding.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 2e5702a ("drm/nouveau: fabricate DCB encoder table for iMac G4")
Fixes: 670820c ("drm/nouveau: Workaround incorrect DCB entry on a GeForce3 Ti 200.")
Signed-off-by: Mikhail Kobuk <m.kobuk@ispras.ru>
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240411110854.16701-1-m.kobuk@ispras.ru1 parent fff1386 commit cf92bb7
1 file changed
Lines changed: 7 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
1677 | 1678 | | |
1678 | 1679 | | |
1679 | 1680 | | |
1680 | | - | |
| 1681 | + | |
1681 | 1682 | | |
1682 | 1683 | | |
1683 | 1684 | | |
| |||
1763 | 1764 | | |
1764 | 1765 | | |
1765 | 1766 | | |
1766 | | - | |
1767 | | - | |
| 1767 | + | |
| 1768 | + | |
1768 | 1769 | | |
1769 | 1770 | | |
1770 | 1771 | | |
1771 | 1772 | | |
1772 | 1773 | | |
1773 | 1774 | | |
1774 | | - | |
| 1775 | + | |
1775 | 1776 | | |
1776 | 1777 | | |
1777 | 1778 | | |
1778 | 1779 | | |
1779 | | - | |
| 1780 | + | |
1780 | 1781 | | |
1781 | 1782 | | |
1782 | 1783 | | |
1783 | 1784 | | |
1784 | 1785 | | |
1785 | | - | |
| 1786 | + | |
1786 | 1787 | | |
1787 | 1788 | | |
1788 | 1789 | | |
| |||
0 commit comments