]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
media: dib8000: avoid division by 0 in dib8000_set_dds()
authorSergey Shtylyov <s.shtylyov@auroraos.dev>
Fri, 6 Feb 2026 14:22:26 +0000 (17:22 +0300)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Mon, 16 Mar 2026 15:30:20 +0000 (16:30 +0100)
commitdde3c37af95cd6fa301c4906f33d627bc9dd874c
treea793a4f8c1ba2f6e92ba3d7ecb0d647e01561bf3
parentf48753aa3a109051e63e050e796f7d4cc6f22d3c
media: dib8000: avoid division by 0 in dib8000_set_dds()

In dib8000_set_dds(), 1 << 26 (67108864) divided by e.g. 1 apparently can't
fit into 16-bit variable unit_khz_dds_val, being truncated to 0; this will
cause division by 0 while calling dprintk() with debugging enabled (via the
module parameter).  Use s32 instead of s16 to declare the variable, getting
rid of the cast to u16 in the *else* branch as well...

Found by Linux Verification Center (linuxtesting.org) with the Svace static
analysis tool.

Fixes: 173a64cb3fcf ("[media] dib8000: enhancement")
Cc: stable@vger.kernel.org
Signed-off-by: Sergey Shtylyov <s.shtylyov@auroraos.dev>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/dvb-frontends/dib8000.c