Re: p = kmalloc(sizeof(*p), )

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux