mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Oeser <ioe-lkml@rameria.de>
To: "Pekka Enberg" <penberg@cs.helsinki.fi>
Cc: "Yan Burman" <burman.yan@gmail.com>,
	linux-kernel@vger.kernel.org, trivial@kernel.org,
	cramerj@intel.com
Subject: Re: [PATCH 2.6.19] e1000: replace kmalloc with kzalloc
Date: Sun, 17 Dec 2006 13:17:29 +0100	[thread overview]
Message-ID: <200612171317.32003.ioe-lkml@rameria.de> (raw)
In-Reply-To: <84144f020612120934n612f513er606d2653f527eb67@mail.gmail.com>

On Tuesday, 12. December 2006 18:34, Pekka Enberg wrote:
> On 12/12/06, Yan Burman <burman.yan@gmail.com> wrote:
> >         size = txdr->count * sizeof(struct e1000_buffer);
> > -       if (!(txdr->buffer_info = kmalloc(size, GFP_KERNEL))) {
> > +       if (!(txdr->buffer_info = kzalloc(size, GFP_KERNEL))) {
> >                 ret_val = 1;
> >                 goto err_nomem;
> >         }
> > -       memset(txdr->buffer_info, 0, size);
> 
> No one seems to be using size elsewhere so why not convert to
> kcalloc() and get rid of it? (Seems to apply to other places as well.)

Because if done properly that often exceeds the 80 column limit.
The intermediate variable should be optimized away from the compiler.

But kcalloc() is better for another reason: Overflow checking.

Regards

Ingo Oeser

      parent reply	other threads:[~2006-12-17 12:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-12 16:53 Yan Burman
2006-12-12 17:34 ` Pekka Enberg
2006-12-12 18:32   ` Auke Kok
2006-12-17 12:17   ` Ingo Oeser [this message]

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=200612171317.32003.ioe-lkml@rameria.de \
    --to=ioe-lkml@rameria.de \
    --cc=burman.yan@gmail.com \
    --cc=cramerj@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penberg@cs.helsinki.fi \
    --cc=trivial@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®