[PATCH] BUG() when passing illegal parameters to decode_rs8() or decode_rs16()

Thomas Gleixner tglx at linutronix.de
Sun Oct 21 04:04:07 EDT 2007


On Sat, 20 Oct 2007, Jörn Engel wrote:

> Returning -ERANGE should never happen.
> 
> --- linux-2.6.22cow/lib/reed_solomon/decode_rs.c~rs_ERANGE	2006-10-13 15:58:51.000000000 +0200
> +++ linux-2.6.22cow/lib/reed_solomon/decode_rs.c	2007-10-20 13:07:57.000000000 +0200
> @@ -39,8 +39,7 @@
>  
>  	/* Check length parameter for validity */
>  	pad = nn - nroots - len;
> -	if (pad < 0 || pad >= nn)
> -		return -ERANGE;
> +	BUG_ON(pad < 0 || pad >= nn);

No. This is not a critical error. You escalate a situation where the
kernel can still survive to a fatal error.

       tglx


More information about the linux-mtd mailing list