MTD concat layer

David Woodhouse dwmw2 at infradead.org
Mon Feb 18 04:05:55 EST 2002


rob at sysgo.de said:
>  Now, here comes the problem. In the context of an erase function,
> what does "predictable behavior" mean ? If it returns EINVAL, the
> caller can see that they passed a faulty parameter, so does it make
> any difference wether some of the specified flash range have been
> erased in the process ? By specifying a certain area of flash to be
> erased, the user has by definition given up any hope of seeing the
> data in that area again.

There is never any excuse for passing invalid offset/length to the erase
function - even the ioctl code can do a sanity check before passing through
the values provided by the user.

For errors which can understandably occur, your concerns are valid and we 
should ensure sanity by failing the request as safely as possible, doing 
nothing else.

This is not such an error. As long as the ioctl() has an appropriate sanity 
check, the occurrence of such an error indicates that the kernel code is 
completely broken. Better to BUG() than return an error, in that case - 
that way, there's no chance that the broken code will try again, and happen 
to pick a range which _does_ look valid, but which it still shouldn't be 
erasing.


--
dwmw2






More information about the linux-mtd mailing list