lkml.org 
[lkml]   [2003]   [Sep]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH] kmalloc + memset(foo, 0, bar) = kmalloc0
On Thu, Sep 11, 2003 at 03:40:58PM +0200, Rolf Eike Beer wrote:
> Hi,
>
> a (very) simple grep in drivers/ showed more than 300 matches of code like
> this:
>
> foo = kmalloc(bar, baz);
> if (! foo)
> return -ENOMEM;
> memset(foo, 0, sizeof(foo));

Erm. It would better *not* be there in such amounts - sizeof(foo) would
be a size of pointer...

> Why not add a small inlined function doing the memset for us
> and reducing the code to
>
> foo = kmalloc0(bar, baz);
> if (! foo)
> return -ENOMEM;

Bad choice of name - too easy to confuse with kmalloc().
-
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/

\
 
 \ /
  Last update: 2005-03-22 13:48    [W:0.070 / U:0.480 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site