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]
Message-ID: <Pine.LNX.4.64.1010181957520.15744@ask.diku.dk>
Date:	Mon, 18 Oct 2010 19:58:23 +0200 (CEST)
From:	Julia Lawall <julia@...u.dk>
To:	Joe Perches <joe@...ches.com>
Cc:	walter harms <wharms@....de>, devel@...verdev.osuosl.org,
	gregkh@...e.de, kernel-janitors@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] drivers/staging/cx25821: Use kstrdup

On Mon, 18 Oct 2010, Joe Perches wrote:

> On Mon, 2010-10-18 at 19:44 +0200, Julia Lawall wrote:
> > On Mon, 18 Oct 2010, Joe Perches wrote:
> > 
> > > Perhaps it's more readable code to recheck the
> > > field name flag and introduce a temporary
> > > char *fname so the slightly unusual reuse of
> > > 	field = kstrdup(field, GFP)
> > > becomes
> > > 	field = kstrdup(fname, GFP)
> > 
> > Before I had a local variable filename.  I preferred that because I felt 
> > uneasy about putting both statically and dynamically allocated memory in 
> > the same field.  But it does mean adding a new local variable.
> 
> I think readability is better using a temporary.
> 
> > I'm not sure to understand "recheck the field name flag", though.
> 
> Sorry, poor wording.  I meant using this style:
> 
> 	if (field && *field)
> 		foo
> 	else if (field)
> 		bar
> 	else
> 		baz
> 
> instead of:
> 
> 	if (field) {
> 		if (*field)
> 			foo
> 		else
> 			bar
> 	} else
> 		baz

OK :)  I'll do that.

julia
--
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