linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: lgdt3306a: fix a missing check of return value
@ 2018-12-20  7:48 Kangjie Lu
  0 siblings, 0 replies; only message in thread
From: Kangjie Lu @ 2018-12-20  7:48 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Mauro Carvalho Chehab, Brad Love, Michael Ira Krufky,
	Luc Van Oostenryck, linux-media, linux-kernel

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.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/media/dvb-frontends/lgdt3306a.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/lgdt3306a.c b/drivers/media/dvb-frontends/lgdt3306a.c
index 0e1f5daaf20c..7410f23314bc 100644
--- a/drivers/media/dvb-frontends/lgdt3306a.c
+++ b/drivers/media/dvb-frontends/lgdt3306a.c
@@ -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
-- 
2.17.2 (Apple Git-113)


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-12-20  7:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-20  7:48 [PATCH] media: lgdt3306a: fix a missing check of return value Kangjie Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).