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:	Wed, 18 Jul 2007 13:40:13 +0200
From:	Cornelia Huck <cornelia.huck@...ibm.com>
To:	Tejun Heo <htejun@...il.com>
Cc:	Gabriel C <nix.or.die@...glemail.com>,
	Satyam Sharma <satyam.sharma@...il.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Christoph Lameter <clameter@....com>, gregkh@...e.de,
	miles.lane@...il.com
Subject: Re: [PATCH] sysfs: cosmetic clean up on node creation failure paths

On Wed, 18 Jul 2007 16:38:11 +0900,
Tejun Heo <htejun@...il.com> wrote:

> Node addition failure is detected by testing return value of
> sysfs_addfm_finish() which returns the number of added and removed
> nodes.  As the function is called as the last step of addition right
> on top of error handling block, the if blocks looked like the
> following.
> 
> 	if (sysfs_addrm_finish(&acxt))
> 		success handling, usually return;
> 	/* fall through to error handling */
> 
> This is the opposite of usual convention in sysfs and makes the code
> difficult to understand.  This patch inverts the test and makes those
> blocks look more like others.
> 
> Signed-off-by: Tejun Heo <htejun@...il.com>
> ---
>  fs/sysfs/dir.c     |   12 +++++++-----
>  fs/sysfs/file.c    |    9 +++++----
>  fs/sysfs/symlink.c |   10 ++++++----
>  3 files changed, 18 insertions(+), 13 deletions(-)

Looks nice. One thing, though:

sysfs_hash_and_remove() has the same check, but without a cleanup
section. This should follow the (!sysfs_addrm_finish()) pattern as well
(makes pattern matching easier when reading the code).
-
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