]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
media: ts2020: Variable "utmp" in function ts2020_set_tuner_rf() could be uninitialized
authorYizhuo <yzhai003@ucr.edu>
Wed, 30 Jan 2019 17:33:30 +0000 (12:33 -0500)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mon, 22 Apr 2019 17:05:54 +0000 (13:05 -0400)
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@ucr.edu>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/dvb-frontends/ts2020.c

index e5cd2cd414f4ea83f7dd9913727b3a12adaca2db..0af9b335be120751519e11bca8aa098d82ef428c 100644 (file)
@@ -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;