lkml.org 
[lkml]   [2003]   [Sep]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [RFC][PATCH] kmalloc + memset(foo, 0, bar) = kmalloc0
    Date
    Am Donnerstag, 11. September 2003 15:45 schrieben Sie:
    > 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...

    Eek, yes. Typo from me.

    > > 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().

    Yes, maybe. But don't expect more innovations from me today, it's someone
    else's turn ;)

    Eike
    -
    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.019 / U:59.792 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site