Messages in this thread | ![/](/images/icornerl.gif) | | Subject | Re: p = kmalloc(sizeof(*p), ) | From | Alan Cox <> | Date | Tue, 20 Sep 2005 21:41:36 +0100 |
| |
On Maw, 2005-09-20 at 10:59 -0700, Andrew Morton wrote: > umm, the three reasons which you deleted from the mail to which you're > replying?
There were no reasons given in the mail I replied to. Perhaps I missed another mail from you earlier.
I'm also puzzled by the one comemnt you made. You seem to imply that seeing
foo = malloc(sizeof(*foo))
means it doesn't need checking. That is false on various grounds
1. A lot of stuff is using void *, char * etc 2. You've no idea that foo is the full object not a generic object with stuff tacked on.
So thats very much false. You have to know what is really being allocated in both cases. In the sizeof(*foo) case you also have to go back, work out wtf foo really is and check that its not an array pointer because sizeof char[40] is not the same as sizeof(* char *).
Thankfully Linus hates typedefs so that removes many of those
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| ![\](/images/icornerr.gif) |