diff mbox

[media] s5k6aa: off by one in s5k6aa_enum_frame_interval()

Message ID 20130823093306.GH31293@elgon.mountain (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter Aug. 23, 2013, 9:33 a.m. UTC
The check is off by one so we could read one space past the end of the
array.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Laurent Pinchart Aug. 23, 2013, 12:54 p.m. UTC | #1
Hi Dan,

Thank you for the patch.

On Friday 23 August 2013 12:33:06 Dan Carpenter wrote:
> The check is off by one so we could read one space past the end of the
> array.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Mauro, I have no other pending sensor patches, can you pick this one up from 
the list, or should I send you a pull request ?

> diff --git a/drivers/media/i2c/s5k6aa.c b/drivers/media/i2c/s5k6aa.c
> index 789c02a..629a5cd 100644
> --- a/drivers/media/i2c/s5k6aa.c
> +++ b/drivers/media/i2c/s5k6aa.c
> @@ -1003,7 +1003,7 @@ static int s5k6aa_enum_frame_interval(struct
> v4l2_subdev *sd, const struct s5k6aa_interval *fi;
>  	int ret = 0;
> 
> -	if (fie->index > ARRAY_SIZE(s5k6aa_intervals))
> +	if (fie->index >= ARRAY_SIZE(s5k6aa_intervals))
>  		return -EINVAL;
> 
>  	v4l_bound_align_image(&fie->width, S5K6AA_WIN_WIDTH_MIN,
Hi Laurent,

On 08/23/2013 02:54 PM, Laurent Pinchart wrote:
> Hi Dan,
> 
> Thank you for the patch.
> 
> On Friday 23 August 2013 12:33:06 Dan Carpenter wrote:
>> The check is off by one so we could read one space past the end of the
>> array.
>>
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> Mauro, I have no other pending sensor patches, can you pick this one up from 
> the list, or should I send you a pull request ?

I can handle all pending patches for the Samsung sensors, I was planning
to send a pull request today. I can pick up the ov9650 patch as well.
I'd like to also include the s5k5bafx sensor patch in one of my pull
requests.

IIRC it was agreed that we as Samsung will handle our stuff ourselves
and be sending it to Mauro directly.

--
Thanks,
Sylwester
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Laurent Pinchart Aug. 23, 2013, 1:16 p.m. UTC | #3
Hi Sylwester,

On Friday 23 August 2013 15:11:49 Sylwester Nawrocki wrote:
> On 08/23/2013 02:54 PM, Laurent Pinchart wrote:
> > On Friday 23 August 2013 12:33:06 Dan Carpenter wrote:
> >> The check is off by one so we could read one space past the end of the
> >> array.
> >> 
> >> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > 
> > Mauro, I have no other pending sensor patches, can you pick this one up
> > from the list, or should I send you a pull request ?
> 
> I can handle all pending patches for the Samsung sensors, I was planning
> to send a pull request today. I can pick up the ov9650 patch as well.
> I'd like to also include the s5k5bafx sensor patch in one of my pull
> requests.
> 
> IIRC it was agreed that we as Samsung will handle our stuff ourselves
> and be sending it to Mauro directly.

That's less work for me, so I will definitely not complain :-)
diff mbox

Patch

diff --git a/drivers/media/i2c/s5k6aa.c b/drivers/media/i2c/s5k6aa.c
index 789c02a..629a5cd 100644
--- a/drivers/media/i2c/s5k6aa.c
+++ b/drivers/media/i2c/s5k6aa.c
@@ -1003,7 +1003,7 @@  static int s5k6aa_enum_frame_interval(struct v4l2_subdev *sd,
 	const struct s5k6aa_interval *fi;
 	int ret = 0;
 
-	if (fie->index > ARRAY_SIZE(s5k6aa_intervals))
+	if (fie->index >= ARRAY_SIZE(s5k6aa_intervals))
 		return -EINVAL;
 
 	v4l_bound_align_image(&fie->width, S5K6AA_WIN_WIDTH_MIN,