[Skiboot] [PATCH] flash: fix offset and size parameters check

Cedric Le Goater clg at fr.ibm.com
Mon Jun 15 19:54:50 AEST 2015


On 06/13/2015 06:42 AM, Jeremy Kerr wrote:
> Hi Cédric,
> 
>>
>> -    if (size >= flash->size || offset >= flash->size
>> -            || offset + size >= flash->size) {
>> +    if (offset + size > flash->size) {
>>           rc = OPAL_PARAMETER;
>>           goto err;
>>       }
> 
> This loses the check for the overflow condition (where offset + size wraps), which we got from flash->size being a u32. How about we just make the minimal fix:
> 
>              || offset + size > flash->size
> 
> ?

Will do that. V2 should arrive soon.

Thanks,

C.


> 
> Or, make the overflow check explicit.
> 
> Cheers,
> 
> 
> Jeremy
> 
> 



More information about the Skiboot mailing list