Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

objtool, media: dib8000: Prevent divide-by-zero in dib8000_set_dds()

If dib8000_set_dds()'s call to dib8000_read32() returns zero, the result
is a divide-by-zero. Prevent that from happening.

Fixes the following warning with an UBSAN kernel:

drivers/media/dvb-frontends/dib8000.o: warning: objtool: dib8000_tune() falls through to next function dib8096p_cfg_DibRx()

Fixes: 173a64cb3fcf ("[media] dib8000: enhancement")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/bd1d504d930ae3f073b1e071bcf62cae7708773c.1742852847.git.jpoimboe@kernel.org
Closes: https://lore.kernel.org/r/202503210602.fvH5DO1i-lkp@intel.com/

authored by

Josh Poimboeuf and committed by
Ingo Molnar
e63d465f 107a2318

+4 -1
+4 -1
drivers/media/dvb-frontends/dib8000.c
··· 2701 2701 u8 ratio; 2702 2702 2703 2703 if (state->revision == 0x8090) { 2704 + u32 internal = dib8000_read32(state, 23) / 1000; 2705 + 2704 2706 ratio = 4; 2705 - unit_khz_dds_val = (1<<26) / (dib8000_read32(state, 23) / 1000); 2707 + 2708 + unit_khz_dds_val = (1<<26) / (internal ?: 1); 2706 2709 if (offset_khz < 0) 2707 2710 dds = (1 << 26) - (abs_offset_khz * unit_khz_dds_val); 2708 2711 else