Re: [PATCH][V2] backlight: sky81452: insure while loop does not allow negative array indexing

From: Daniel Thompson
Date: Fri Feb 28 2020 - 11:46:01 EST


On Thu, Feb 27, 2020 at 03:10:43PM +0000, Colin Ian King wrote:
> On 27/02/2020 11:46, Daniel Thompson wrote:
> > On Wed, Feb 26, 2020 at 07:58:26PM +0000, Colin King wrote:
> >> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
> >>
> >> In the unlikely event that num_entry is zero, the while loop
> >> pre-decrements num_entry to cause negative array indexing into the
> >> array sources. Fix this by iterating only if num_entry >= 0.
> >>
> >> Addresses-Coverity: ("Out-of-bounds read")
> >> Fixes: f705806c9f35 ("backlight: Add support Skyworks SKY81452 backlight driver")
> >> Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
> >> ---
> >>
> >> V2: fix typo in commit subject line
> >
> > Isn't the correct spelling "ensure"?
>
> It is. V1 is correct after all. Doh.

It wasn't spelt "ensure" in v1...


Daniel.