Commit e6a3ea8
committed
media: v4l2-tpg: prevent the risk of a division by zero
As reported by Coverity, the logic at tpg_precalculate_line()
blindly rescales the buffer even when scaled_witdh is equal to
zero. If this ever happens, this will cause a division by zero.
Instead, add a WARN_ON_ONCE() to trigger such cases and return
without doing any precalculation.
Fixes: 63881df ("[media] vivid: add the Test Pattern Generator")
Cc: [email protected]
Signed-off-by: Mauro Carvalho Chehab <[email protected]>1 parent 4c76f33 commit e6a3ea8
1 file changed
+3
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1795 | 1795 | | |
1796 | 1796 | | |
1797 | 1797 | | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
1798 | 1801 | | |
1799 | 1802 | | |
1800 | 1803 | | |
| |||
0 commit comments