Skip to content

Commit e63d465

Browse files
jpoimboeIngo Molnar
authored andcommitted
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: 173a64c ("[media] dib8000: enhancement") Reported-by: kernel test robot <[email protected]> Signed-off-by: Josh Poimboeuf <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Cc: Mauro Carvalho Chehab <[email protected]> Cc: Linus Torvalds <[email protected]> Link: https://lore.kernel.org/r/bd1d504d930ae3f073b1e071bcf62cae7708773c.1742852847.git.jpoimboe@kernel.org Closes: https://lore.kernel.org/r/[email protected]/
1 parent 107a231 commit e63d465

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/media/dvb-frontends/dib8000.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2701,8 +2701,11 @@ static void dib8000_set_dds(struct dib8000_state *state, s32 offset_khz)
27012701
u8 ratio;
27022702

27032703
if (state->revision == 0x8090) {
2704+
u32 internal = dib8000_read32(state, 23) / 1000;
2705+
27042706
ratio = 4;
2705-
unit_khz_dds_val = (1<<26) / (dib8000_read32(state, 23) / 1000);
2707+
2708+
unit_khz_dds_val = (1<<26) / (internal ?: 1);
27062709
if (offset_khz < 0)
27072710
dds = (1 << 26) - (abs_offset_khz * unit_khz_dds_val);
27082711
else

0 commit comments

Comments
 (0)