* [PATCH] media: ov5695: Off by one in ov5695_enum_frame_sizes()
@ 2018-03-01 10:07 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2018-03-01 10:07 UTC (permalink / raw)
To: Shunqian Zheng; +Cc: Mauro Carvalho Chehab, linux-media, kernel-janitors
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>
diff --git a/drivers/media/i2c/ov5695.c b/drivers/media/i2c/ov5695.c
index a4985a4715f5..9be38a0a2046 100644
--- a/drivers/media/i2c/ov5695.c
+++ b/drivers/media/i2c/ov5695.c
@@ -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)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] media: ov5695: Off by one in ov5695_enum_frame_sizes()
@ 2018-03-01 10:07 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2018-03-01 10:07 UTC (permalink / raw)
To: Shunqian Zheng; +Cc: Mauro Carvalho Chehab, linux-media, kernel-janitors
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>
diff --git a/drivers/media/i2c/ov5695.c b/drivers/media/i2c/ov5695.c
index a4985a4715f5..9be38a0a2046 100644
--- a/drivers/media/i2c/ov5695.c
+++ b/drivers/media/i2c/ov5695.c
@@ -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)
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-01 10:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-01 10:07 [PATCH] media: ov5695: Off by one in ov5695_enum_frame_sizes() Dan Carpenter
2018-03-01 10:07 ` Dan Carpenter
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.