Skip to contentSkip to conversation

i2c/ov9650: off by one in ov965x_enum_frame_sizes()

PATCH New Dan Carpenter 1 participant 1 message Aug 23, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c/ov9650: off by one in ov965x_enum_frame_sizes()

The ">" should be ">=" otherwise we read one space beyond the end of the array.

drivers/media/i2c/ov9650.c +1 -1
index 1dbb811..4da90c6 100644
@@ -1083,7 +1083,7 @@ static int ov965x_enum_frame_sizes(struct v4l2_subdev *sd,
 {
 	int i = ARRAY_SIZE(ov965x_formats);
 
-	if (fse->index > ARRAY_SIZE(ov965x_framesizes))
+	if (fse->index >= ARRAY_SIZE(ov965x_framesizes))
 		return -EINVAL;
 
 	while (--i)