On Tue, Sep 20, 2005 at 12:47:32PM +0300, Pekka J Enberg wrote:
> > To find candidates, something like:
> >
> > grep "kmalloc(sizeof([^*]" -r drivers/ | grep -v "sizeof(struct"
> >
> > And then use my eyes to find real bugs.
On Tue, 20 Sep 2005, Al Viro wrote:
> "grep for kmallocs that do not have _either_ form and look for bugs among
> them" is hardly usable as an argument in favour of one of them...
I would disagree with that. The _common case_ for allocation is:
p = kmalloc(sizeof(*p), ...);
For which you know that you are allocating enough memory for the struct.
Now the only way to screw it up is to write:
p = kmalloc(sizeof(p), ...);
That is trivial to grep for.
Yes, currently, typedefs and open-coded kcalloc's give false positives but
that's what kernel janitors are for...
Pekka
-
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]
|
|