All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] [media] cx22700: Fix potential buffer overflow
@ 2014-11-05 12:03 Mauro Carvalho Chehab
  2014-11-05 12:03 ` [PATCH 2/5] [media] cx24110: Fix a spatch warning Mauro Carvalho Chehab
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Mauro Carvalho Chehab @ 2014-11-05 12:03 UTC (permalink / raw)
  To: Linux Media Mailing List; +Cc: Mauro Carvalho Chehab, Mauro Carvalho Chehab

As new FEC types were added, we need a check to avoid overflows:
	drivers/media/dvb-frontends/cx22700.c:172 cx22700_set_tps() error: buffer overflow 'fec_tab' 6 <= 6
	drivers/media/dvb-frontends/cx22700.c:173 cx22700_set_tps() error: buffer overflow 'fec_tab' 6 <= 6

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

diff --git a/drivers/media/dvb-frontends/cx22700.c b/drivers/media/dvb-frontends/cx22700.c
index 3d399d9a6343..86563260d0f2 100644
--- a/drivers/media/dvb-frontends/cx22700.c
+++ b/drivers/media/dvb-frontends/cx22700.c
@@ -169,6 +169,9 @@ static int cx22700_set_tps(struct cx22700_state *state,
 
 	cx22700_writereg (state, 0x04, val);
 
+	if (p->code_rate_HP - FEC_1_2 >= sizeof(fec_tab) ||
+	    p->code_rate_LP - FEC_1_2 >= sizeof(fec_tab))
+		return -EINVAL;
 	val = fec_tab[p->code_rate_HP - FEC_1_2] << 3;
 	val |= fec_tab[p->code_rate_LP - FEC_1_2];
 
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-11-05 12:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-05 12:03 [PATCH 1/5] [media] cx22700: Fix potential buffer overflow Mauro Carvalho Chehab
2014-11-05 12:03 ` [PATCH 2/5] [media] cx24110: Fix a spatch warning Mauro Carvalho Chehab
2014-11-05 12:21   ` Hans Verkuil
2014-11-05 12:41     ` Mauro Carvalho Chehab
2014-11-05 12:03 ` [PATCH 3/5] [media] cx24110: Fix whitespaces at cx24110_set_fec() Mauro Carvalho Chehab
2014-11-05 12:03 ` [PATCH 4/5] [media] cx23110: Fix return code for cx24110_set_fec() Mauro Carvalho Chehab
2014-11-05 12:03 ` [PATCH 5/5] [media] cx24110: Simplify error handling at cx24110_set_fec() Mauro Carvalho Chehab

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.