Re: [PATCH][media-next] media: i2c: mt9v111: fix off-by-one array bounds check

From: Colin Ian King
Date: Tue Jul 31 2018 - 09:55:31 EST


On 31/07/18 14:53, jacopo mondi wrote:
> Hi Colin,
> thanks for the patch.
>
> On Tue, Jul 31, 2018 at 02:33:43PM +0100, Colin King wrote:
>> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
>>
>> The check of fse->index is off-by-one and should be using >= rather
>> than > to check the maximum allowed array index. Fix this.
>>
>> Detected by CoverityScan, CID#172122 ("Out-of-bounds read")
>>
>> Fixes: aab7ed1c3927 ("media: i2c: Add driver for Aptina MT9V111")
>> Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
>
> Acked-by: Jacopo Mondi <jacopo+renesas@xxxxxxxxxx>
>
> Thanks
> j
>

Just to note, I also got a build warning on this driver, so that's
something that should be fixed up too.

drivers/media/i2c/mt9v111.c:887:15: warning: 'idx' may be used
uninitialized in this function [-Wmaybe-uninitialized]
unsigned int idx;


Attachment: signature.asc
Description: OpenPGP digital signature