On Sat, 18 Aug 2007, Thomas Gleixner wrote:No, not valid. Dereferencing it will oops. See ZERO_SIZE_PTR. What we're doing presently is at least better than what SLAB did previously (did return a valid pointer!), all this time :-) I do agree with you in principle, of course. But it's not for the kind of cases that you describe -- "kmalloc(0) just because I'd eventually want to krealloc() it to something meaningful later". This was done because there's a lot of lazy callsites that "don't want to write code for corner cases explicitly". Sad, very sad, I say :-) [ The krealloc() discussion on this thread came about when I noticed that it's the only callsite of ksize() that would reasonably / meaningfully want to deal with NULL ptrs, for whom I noticed (from Andrew's initial mail) that ksize(NULL) returned 0. As you know from the canonical semantics of realloc(), it _is_ supposed to deal with NULL ptrs, hence the discussion. ] Satyam -
| Greg Kroah-Hartman | [PATCH 002/196] Chinese: rephrase English introduction in HOWTO |
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Roland Dreier | Re: Integration of SCST in the mainstream Linux kernel |
git: | |
| Radu Rendec | htb parallelism on multi-core platforms |
| David Miller | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| David Miller | [GIT]: Networking |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
