From 37d1e62b5bb3b1229d0c49f2ee45e67dc67274be Mon Sep 17 00:00:00 2001 From: Yizhuo Date: Wed, 30 Jan 2019 12:33:30 -0500 Subject: 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 Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/ts2020.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/media') diff --git a/drivers/media/dvb-frontends/ts2020.c b/drivers/media/dvb-frontends/ts2020.c index e5cd2cd414f4..0af9b335be12 100644 --- a/drivers/media/dvb-frontends/ts2020.c +++ b/drivers/media/dvb-frontends/ts2020.c @@ -180,6 +180,9 @@ static int ts2020_set_tuner_rf(struct dvb_frontend *fe) unsigned int utmp; ret = regmap_read(dev->regmap, 0x3d, &utmp); + if (ret) + return ret; + utmp &= 0x7f; if (utmp < 0x16) utmp = 0xa1; -- cgit v1.2.3