summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-04-28 09:50:36 -0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-04-30 13:15:31 -0300
commit2f9e682d05e27fef1a78b4089cfde818ea109d25 (patch)
tree31a07b0109c3f06846fb1456928874fe4eccb8f1 /drivers
parent81b7d14e32ddd2ae2709609bb2466f8f2482b8c9 (diff)
downloadtalos-op-linux-2f9e682d05e27fef1a78b4089cfde818ea109d25.tar.gz
talos-op-linux-2f9e682d05e27fef1a78b4089cfde818ea109d25.zip
[media] cx18: avoid going past input/audio array
As reported by smatch: drivers/media/pci/cx18/cx18-driver.c:807 cx18_init_struct2() error: buffer overflow 'cx->card->video_inputs' 6 <= 6 That happens because nof_inputs and nof_audio_inputs can be initialized as CX18_CARD_MAX_VIDEO_INPUTS, instead of CX18_CARD_MAX_VIDEO_INPUTS - 1. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Acked-by: Andy Walls <awalls@md.metrocast.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/pci/cx18/cx18-driver.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c
index 83f5074706f9..260e462d91b4 100644
--- a/drivers/media/pci/cx18/cx18-driver.c
+++ b/drivers/media/pci/cx18/cx18-driver.c
@@ -786,11 +786,11 @@ static void cx18_init_struct2(struct cx18 *cx)
{
int i;
- for (i = 0; i < CX18_CARD_MAX_VIDEO_INPUTS; i++)
+ for (i = 0; i < CX18_CARD_MAX_VIDEO_INPUTS - 1; i++)
if (cx->card->video_inputs[i].video_type == 0)
break;
cx->nof_inputs = i;
- for (i = 0; i < CX18_CARD_MAX_AUDIO_INPUTS; i++)
+ for (i = 0; i < CX18_CARD_MAX_AUDIO_INPUTS - 1; i++)
if (cx->card->audio_inputs[i].audio_type == 0)
break;
cx->nof_audio_inputs = i;
OpenPOWER on IntegriCloud