Re: [PATCH] [v2] media: s3c-camif: fix out-of-bounds array access

2018-01-16 Thread Arnd Bergmann
On Tue, Jan 16, 2018 at 4:44 PM, Sakari Ailus wrote: >> if (camif_mbus_formats[i] == mf->code) >> break; >> >> + if (i == ARRAY_SIZE(camif_mbus_formats)) >> + mf->code = camif_mbus_formats[0]; >> + > > Either else

Re: [PATCH] [v2] media: s3c-camif: fix out-of-bounds array access

2018-01-16 Thread Sakari Ailus
Hi Arnd, Thanks for the patch. Please see my comments below. On Tue, Jan 16, 2018 at 04:30:46PM +0100, Arnd Bergmann wrote: > While experimenting with older compiler versions, I ran > into a warning that no longer shows up on gcc-4.8 or newer: > >

[PATCH] [v2] media: s3c-camif: fix out-of-bounds array access

2018-01-16 Thread Arnd Bergmann
While experimenting with older compiler versions, I ran into a warning that no longer shows up on gcc-4.8 or newer: drivers/media/platform/s3c-camif/camif-capture.c: In function '__camif_subdev_try_format': drivers/media/platform/s3c-camif/camif-capture.c:1265:25: error: array subscript is