Re: [PATCH] [media] s3c-camif: array underflow in __camif_subdev_try_format()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 22, 2018 at 09:50:04PM +0100, Sylwester Nawrocki wrote:
> On 01/22/2018 11:37 AM, Dan Carpenter wrote:
> > --- a/drivers/media/platform/s3c-camif/camif-capture.c
> > +++ b/drivers/media/platform/s3c-camif/camif-capture.c
> > @@ -1261,11 +1261,11 @@ static void __camif_subdev_try_format(struct camif_dev *camif,
> >   	/* FIXME: constraints against codec or preview path ? */
> >   	pix_lim = &variant->vp_pix_limits[VP_CODEC];
> >   
> > -	while (i-- >= 0)
> > +	while (--i >= 0)
> >   		if (camif_mbus_formats[i] == mf->code)
> >   			break;
> > -
> > -	mf->code = camif_mbus_formats[i];
> > +	if (i < 0)
> > +		return;
> 
> Thanks for the patch Dan. mf->width needs to be aligned by this try_format
> function so we shouldn't return here. Also it needs to be ensured mf->code 
> is set to one of the supported values when this function returns. Sorry,
> the current code really doesn't give a clue what was intended.
> 
> There is already queued a patch from Arnd [1] addressing the issues you 
> have found.
>  
> >   	if (pad == CAMIF_SD_PAD_SINK) {
> >   		v4l_bound_align_image(&mf->width, 8, CAMIF_MAX_PIX_WIDTH,
> > 
> 
> [1] https://patchwork.linuxtv.org/patch/46508
> 

Hey Arnd,

I happened to be looking at the same bugs but using Smatch.  Did you get
these two bugs as well?

drivers/scsi/sym53c8xx_2/sym_hipd.c:549 sym_getsync() error: iterator underflow 'div_10M' (-1)-255
drivers/media/i2c/sr030pc30.c:522 try_fmt() error: iterator underflow 'sr030pc30_formats' (-1)-4

regards,
dan carpenter

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



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux