On Sun, Oct 20, 2002 at 08:24:36PM +0200, Andries Brouwer wrote:
> The oops is a dereference of fffffff0 in base/bus.c:driver_attach().
> I have seen several such oopses lately, various places in the kernel.
> The cause here is a NULL pointer that is turned into fffffff0 by
> container_of() and then fed to get_device(). And get_device() tests
> that it gets a non-NULL pointer, but that does not protect against
> fffffff0.

Just as an anecdote - I built a variant of container_of to protect against
cases where NULL can creep in:

#define test_container_of(ptr, type, member) ({               \
        const typeof( ((type *)0)->member ) *__p = (ptr);     \
        __p ? container_of(__p, type, member) : NULL;})

It calls the real container_of only if 'ptr' is not NULL.

-Kevin

-- 
 ------------------------------------------------------------------------
 | Kevin O'Connor                     "BTW, IMHO we need a FAQ for      |
 | [EMAIL PROTECTED]                  'IMHO', 'FAQ', 'BTW', etc. !"    |
 ------------------------------------------------------------------------


-------------------------------------------------------
This sf.net emial is sponsored by: Influence the future 
of Java(TM) technology. Join the Java Community 
Process(SM) (JCP(SM)) program now. 
http://ad.doubleclick.net/clk;4699841;7576301;v?http://www.sun.com/javavote
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to