Skip to contentSkip to conversation

media: lgdt3306a: fix a missing check of return value

PATCH New Kangjie Lu 1 participant 1 message Dec 20, 2018 Media (V4L/DVB)

lore
Share & tools
lore

Kangjie Lu

author
#0 lore raw

PATCH 1/1 media: lgdt3306a: fix a missing check of return value

If lgdt3306a_read_reg() fails, the read data in "val" is incorrect, thus shouldn't be further used. The fix inserts a check for the return value of lgdt3306a_read_reg(). If it fails, goto fail.

---
 drivers/media/dvb-frontends/lgdt3306a.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/dvb-frontends/lgdt3306a.c +3 -1
index 0e1f5daaf20c..7410f23314bc 100644
@@ -1685,7 +1685,9 @@ static int lgdt3306a_read_signal_strength(struct dvb_frontend *fe,
 	case QAM_256:
 	case QAM_AUTO:
 		/* need to know actual modulation to set proper SNR baseline */
-		lgdt3306a_read_reg(state, 0x00a6, &val);
+		ret = lgdt3306a_read_reg(state, 0x00a6, &val);
+		if (lg_chkerr(ret))
+			goto fail;
 		if(val & 0x04)
 			ref_snr = 2800; /* QAM-256 28dB */
 		else
Signature · 1 line
2.17.2 (Apple Git-113)