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:	Tue, 24 Feb 2015 00:27:25 -0800
From:	Brian Norris <computersforpeace@...il.com>
To:	Felix Fietkau <nbd@...nwrt.org>
Cc:	Rodrigo Freire <rfreire@...hat.com>, linux-mtd@...ts.infradead.org,
	linux-kernel@...r.kernel.org,
	Jörn Engel <joern@...fs.org>,
	dwmw2@...radead.org, Herton Krzesinski <hkrzesin@...hat.com>
Subject: Re: [PATCH v3 3/3] mtd: block2mtd: Removes PAGE_MASK as a index to
 partition size

On Tue, Feb 24, 2015 at 09:20:31PM +1300, Felix Fietkau wrote:
> On 2015-02-24 21:07, Brian Norris wrote:
> > On Wed, Nov 26, 2014 at 08:19:32AM -0500, Rodrigo Freire wrote:
> >> From: "Brian Norris" <computersforpeace@...il.com>
> >> Sent: Wednesday, November 26, 2014 5:21:47 AM
> >> Subject: Re: [PATCH v3 3/3] mtd: block2mtd: Removes PAGE_MASK as a index to
> >> partition size
> >> 
> >> > On Sun, Nov 09, 2014 at 07:23:12AM -0500, Rodrigo Freire wrote:
> >> > > - dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK;
> >> > > + dev->mtd.size = dev->blkdev->bd_inode->i_size & ~(erase_size - 1);
> >> 
> >> > You never guaranteed that erase_size is a power of two, so this doesn't
> >> > necessarily mask the way you'd like...
> >> 
> >> > But also, why is this even necessary? I see that we should already have
> >> > errored out if this was actually significant, since we have above:
> >> 
> >> > if ((long)dev->blkdev->bd_inode->i_size % erase_size) {
> >> > pr_err("erasesize must be a divisor of device size\n");
> >> > goto err_free_block2mtd;
> >> > }
> >> 
> >> Hello Brian, and thanks for the review.
> >> 
> >> Honestly, I'd leave that untouched, but Jörn pointed that it could be a issue at https://lkml.org/lkml/2014/9/9/680
> >> 
> >> I'd happily let it go without this patch 3, unless Jörg wants to state otherwise.
> > 
> > OK let's drop this patch from the series. At best, we could just do
> > something like this instead:
> > 
> > -	dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK;
> > +	dev->mtd.size = dev->blkdev->bd_inode->i_size;
> > 
> > But that's really just an unnecessary change.
> If I remember correctly, it was problematic to have a dev->mtd.size
> value which is not a multiple of the erase size. I think that was the
> reason for patch 3.

The what's this for?

	if ((long)dev->blkdev->bd_inode->i_size % erase_size) {
		pr_err("erasesize must be a divisor of device size\n");
		goto err_free_block2mtd;
	}

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