lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <200612171317.32003.ioe-lkml@rameria.de>
Date:	Sun, 17 Dec 2006 13:17:29 +0100
From:	Ingo Oeser <ioe-lkml@...eria.de>
To:	"Pekka Enberg" <penberg@...helsinki.fi>
Cc:	"Yan Burman" <burman.yan@...il.com>, linux-kernel@...r.kernel.org,
	trivial@...nel.org, cramerj@...el.com
Subject: Re: [PATCH 2.6.19] e1000: replace kmalloc with kzalloc

On Tuesday, 12. December 2006 18:34, Pekka Enberg wrote:
> On 12/12/06, Yan Burman <burman.yan@...il.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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ