media: ov5695: Off by one in ov5695_enum_frame_sizes()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 1 Mar 2018 10:07:14 +0000 (05:07 -0500)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 6 Mar 2018 17:25:10 +0000 (12:25 -0500)
The ">" should be ">=" so that we don't read one element beyond the end
of the array.

Fixes: 8a77009be4be ("media: ov5695: add support for OV5695 sensor")

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/i2c/ov5695.c

index a4985a4..9be38a0 100644 (file)
@@ -884,7 +884,7 @@ static int ov5695_enum_frame_sizes(struct v4l2_subdev *sd,
                                   struct v4l2_subdev_pad_config *cfg,
                                   struct v4l2_subdev_frame_size_enum *fse)
 {
-       if (fse->index > ARRAY_SIZE(supported_modes))
+       if (fse->index >= ARRAY_SIZE(supported_modes))
                return -EINVAL;
 
        if (fse->code != MEDIA_BUS_FMT_SBGGR10_1X10)