mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-09-18 23:09:29 +02:00
media: tda18250: fix possible integer overflow
Integer overflow may occur, when variable exp equals to zero. Result
of shift 1 << (exp - 1) may then leads to undefined behavior.
Fixes: 148abd3b5b ("media: tda18250: support for new silicon tuner")
Cc: stable@vger.kernel.org
Signed-off-by: Ilya Krutskih <devsec@tpz.ru>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
committed by
Hans Verkuil
parent
28e84c6e2e
commit
6dd8e257f7
@@ -440,8 +440,8 @@ static int tda18250_pll_calc(struct dvb_frontend *fe, u8 *rdiv,
|
||||
goto err;
|
||||
|
||||
exp = (uval & 0x70) >> 4;
|
||||
if (exp > 5)
|
||||
exp = 0;
|
||||
if (exp == 0 || exp > 5)
|
||||
exp = 1;
|
||||
lopd = 1 << (exp - 1);
|
||||
scale = uval & 0x0f;
|
||||
fvco = lopd * scale * ((c->frequency / 1000) + dev->if_frequency);
|
||||
|
||||
Reference in New Issue
Block a user