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

Jeremy Kerr jk at ozlabs.org
Sat Jun 13 14:42:30 AEST 2015


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

?

Or, make the overflow check explicit.

Cheers,


Jeremy




More information about the Skiboot mailing list