[dm-devel] [PATCH 2/6] dm: introduce dm_accept_partial_bio

Mikulas Patocka mpatocka at redhat.com
Mon Mar 17 22:45:06 UTC 2014



On Mon, 17 Mar 2014, Mike Snitzer wrote:

> > > I do however want you to add yet another BUG_ON for any bio that isn't
> > > meant to be sent to this interface (only one so far is REQ_FLUSH AFAIK).
> > 
> > Then, it triggers NULL pointer dereference. You don't have to add BUG_ON 
> > for it, it crashes anyway.
> 
> I understand it'll NULL pointer, but that is _always_ confusing for
> someone who wasn't the original developer.  Please add the explicit
> BUG_ON() for REQ_FLUSH.

The user will not hit a BUG with REQ_FLUSH. Regarding the developer - it 
is expected that the kernel developer is able to decode the oops message, 
compare it with disassembled code and find out which variable was NULL. 
The function is small, so it's an easy task.

We don't really need
BUG_ON(!pointer);
variable = *pointer;

Mikulas




More information about the dm-devel mailing list