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] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 21 Jul 2006 12:35:56 +0200
From:	Panagiotis Issaris <takis@....org>
To:	Jesper Juhl <jesper.juhl@...il.com>
Cc:	Stefan Richter <stefanr@...6.in-berlin.de>,
	Jeff Garzik <jgarzik@...ox.com>,
	Pekka Enberg <penberg@...helsinki.fi>,
	Rolf Eike Beer <eike-kernel@...tec.de>,
	Panagiotis Issaris <takis@...umba.uhasselt.be>,
	linux-kernel@...r.kernel.org, len.brown@...el.com,
	chas@....nrl.navy.mil, miquel@...uba.ar, kkeil@...e.de,
	benh@...nel.crashing.org, video4linux-list@...hat.com,
	rmk+mmc@....linux.org.uk, Neela.Kolli@...enio.com,
	vandrove@...cvut.cz, adaplas@....net, thomas@...ischhofer.net,
	weissg@...nna.at, philb@....org, linux-pcmcia@...ts.infradead.org,
	jkmaline@...hut.fi, paulus@...ba.org
Subject: Re: [PATCH] drivers: Conversions from kmalloc+memset to
	k(z|c)alloc.

Hi,

On vr, 2006-07-21 at 12:20 +0200, Jesper Juhl wrote:
> [snip]
> >  - better style of the size argument where correct,
> 
> Who says it's "better style" ?
Documentation/CodingStyle does :) (which in fact, I only noticed when I
was validating someone's remark that it would be a good idea to change
sizeof's)

"The preferred form for passing a size of a struct is the following:

        p = kmalloc(sizeof(*p), ...);

The alternative form where struct name is spelled out hurts readability
and introduces an opportunity for a bug when the pointer variable type
is changed but the corresponding sizeof that is passed to a memory
allocator is not."


> You can argue that   sizeof(type) is more readable.
> When reading the code you don't have to go lookup the type of ptr in
> sizeof(*ptr)  before you know what type the code is working with.


With friendly regards,
Takis

-
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