summaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb-frontends/dib7000p.c
diff options
context:
space:
mode:
authorDaniil Dulov <d.dulov@aladdin.ru>2023-03-24 14:38:32 +0100
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2023-07-19 12:57:47 +0200
commita1db7b2c5533fc67e2681eb5efc921a67bc7d5b8 (patch)
tree329903cf64e11c64885f5750cd462c1f1a931d95 /drivers/media/dvb-frontends/dib7000p.c
parentmedia: cx18: remove unnecessary (void*) conversions (diff)
downloadlinux-a1db7b2c5533fc67e2681eb5efc921a67bc7d5b8.tar.xz
linux-a1db7b2c5533fc67e2681eb5efc921a67bc7d5b8.zip
media: dib7000p: Fix potential division by zero
Variable loopdiv can be assigned 0, then it is used as a denominator, without checking it for 0. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 713d54a8bd81 ("[media] DiB7090: add support for the dib7090 based") Signed-off-by: Daniil Dulov <d.dulov@aladdin.ru> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> [hverkuil: (bw != NULL) -> bw]
Diffstat (limited to '')
-rw-r--r--drivers/media/dvb-frontends/dib7000p.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/dvb-frontends/dib7000p.c b/drivers/media/dvb-frontends/dib7000p.c
index a90d2f51868f..632534eff0ff 100644
--- a/drivers/media/dvb-frontends/dib7000p.c
+++ b/drivers/media/dvb-frontends/dib7000p.c
@@ -497,7 +497,7 @@ static int dib7000p_update_pll(struct dvb_frontend *fe, struct dibx000_bandwidth
prediv = reg_1856 & 0x3f;
loopdiv = (reg_1856 >> 6) & 0x3f;
- if ((bw != NULL) && (bw->pll_prediv != prediv || bw->pll_ratio != loopdiv)) {
+ if (loopdiv && bw && (bw->pll_prediv != prediv || bw->pll_ratio != loopdiv)) {
dprintk("Updating pll (prediv: old = %d new = %d ; loopdiv : old = %d new = %d)\n", prediv, bw->pll_prediv, loopdiv, bw->pll_ratio);
reg_1856 &= 0xf000;
reg_1857 = dib7000p_read_word(state, 1857);