All of lore.kernel.org
 help / color / mirror / Atom feed
From: viro@parcelfarce.linux.theplanet.co.uk
To: Rolf Eike Beer <eike-kernel@sf-tec.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC][PATCH] kmalloc + memset(foo, 0, bar) = kmalloc0
Date: Thu, 11 Sep 2003 14:45:57 +0100	[thread overview]
Message-ID: <20030911134557.GV454@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <200309111540.58729@bilbo.math.uni-mannheim.de>

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

  reply	other threads:[~2003-09-11 13:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-11 13:40 [RFC][PATCH] kmalloc + memset(foo, 0, bar) = kmalloc0 Rolf Eike Beer
2003-09-11 13:45 ` viro [this message]
2003-09-11 14:11   ` Rolf Eike Beer
2003-09-11 17:09   ` Jamie Lokier
2003-09-11 21:58     ` J.A. Magallon
2003-09-11 22:12       ` Alan Cox
2003-09-11 22:25         ` J.A. Magallon
2003-09-11 13:58 ` Breno Silva

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030911134557.GV454@parcelfarce.linux.theplanet.co.uk \
    --to=viro@parcelfarce.linux.theplanet.co.uk \
    --cc=eike-kernel@sf-tec.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.