[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20190130173331.4672-1-yzhai003@ucr.edu>
Date: Wed, 30 Jan 2019 09:33:30 -0800
From: Yizhuo <yzhai003@....edu>
To: unlisted-recipients:; (no To-header on input)
Cc: csong@...ucr.edu, zhiyunq@...ucr.edu, Yizhuo <yzhai003@....edu>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] [media] ts2020: Variable "utmp" in function ts2020_set_tuner_rf() could be uninitialized
In function ts2020_set_tuner_rf(), local variable "utmp" could
be uninitialized if function regmap_read() returns -EINVAL.
However, this value is used in if statement and written to
the register, which is potentially unsafe.
Signed-off-by: Yizhuo <yzhai003@....edu>
---
drivers/media/dvb-frontends/ts2020.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/media/dvb-frontends/ts2020.c b/drivers/media/dvb-frontends/ts2020.c
index 931e5c98da8a..e351039f2eae 100644
--- a/drivers/media/dvb-frontends/ts2020.c
+++ b/drivers/media/dvb-frontends/ts2020.c
@@ -177,9 +177,12 @@ static int ts2020_set_tuner_rf(struct dvb_frontend *fe)
{
struct ts2020_priv *dev = fe->tuner_priv;
int ret;
- unsigned int utmp;
+ unsigned int utmp = 0;
ret = regmap_read(dev->regmap, 0x3d, &utmp);
+ if (ret)
+ return ret;
+
utmp &= 0x7f;
if (utmp < 0x16)
utmp = 0xa1;
--
2.17.1
Powered by blists - more mailing lists