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: <20070617125232.GA32374@saeurebad.de>
Date:	Sun, 17 Jun 2007 14:52:32 +0200
From:	Johannes Weiner <hannes-kernel@...urebad.de>
To:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Cc:	Bj?rn Steinbrink <B.Steinbrink@....de>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] Replace obscure constructs in fs/block_dev.c

Hi,

On Sun, Jun 17, 2007 at 11:38:55AM +0200, Bjoern Steinbrink wrote:
[SNIP]
> > -	/* first decide result */
> > -	if (bdev->bd_holder == holder)
> > -		res = 0;	 /* already a holder */
> > -	else if (bdev->bd_holder != NULL)
> > -		res = -EBUSY; 	 /* held by someone else */
> > -	else if (bdev->bd_contains == bdev)
> > -		res = 0;  	 /* is a whole device which isn't held */
> > -
> > -	else if (bdev->bd_contains->bd_holder == bd_claim)
> > -		res = 0; 	 /* is a partition of a device that is being partitioned */
> > -	else if (bdev->bd_contains->bd_holder != NULL)
> > -		res = -EBUSY;	 /* is a partition of a held device */
> > -	else
> > -		res = 0;	 /* is a partition of an un-held device */
> > +	/* If already held by someone else or we have a
> > +	 * partition of a held device, we do nothing. */
> >  
> > -	/* now impose change */
> > -	if (res==0) {
> > +	if (bdev->bd_holder || bdev->bd_contains->bd_holder)
> > +		res = -EBUSY;
[SNAP]

> Hm, that actually ignores the "someone else" part of the comment and
> introduces a semantic change. No idea, if it breaks anything though.

Whoops, yes. ->bd_holder can be actually !NULL when it is == holder.
Same for ->bd_contains->bd_holder. Also the `is a whole unheld device'
was ignored - sorry. Second try:


This patch replaces some obscure code-paths in fs/block_dev.c with more
readable versions.

Signed-off-by: Johannes Weiner <hannes-kernel@...urebad.de>

View attachment "block_dev-anti-obscurity-r1.patch" of type "text/plain" (2711 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ