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:	Thu, 23 Jun 2016 15:30:15 +0200
From:	Arnd Bergmann <arnd@...db.de>
To:	Jens Axboe <axboe@...com>
Cc:	"Nicholas A . Bellinger" <nab@...ux-iscsi.org>,
	Mike Christie <mchristi@...hat.com>,
	Andy Grover <agrover@...hat.com>,
	Hannes Reinecke <hare@...e.com>, linux-scsi@...r.kernel.org,
	target-devel@...r.kernel.org, linux-kernel@...r.kernel.org,
	Christoph Hellwig <hch@...radead.org>,
	Davidlohr Bueso <dave@...olabs.net>, linux-efi@...r.kernel.org,
	linux-block@...r.kernel.org, Arnd Bergmann <arnd@...db.de>
Subject: [PATCH v2 2/3] partition/efi: use bdev_logical_block_count()

Enabling CONFIG_UBSAN_SANITIZE_ALL on ARM caused a link error:

last_lba.part.0':
:(.text+0xc3440): undefined reference to `____ilog2_NaN'
:(.text+0xc3538): undefined reference to `__aeabi_uldivmod'
:(.text+0xc38e8): undefined reference to `__aeabi_uldivmod'

This is caused by gcc not behaving in the expected ways with __builtin_constant_p(),
but it also points to somewhat inefficient code based on a 64-bit
division.

I have introduced a better bdev_logical_block_count() now, so we
can use that here.

Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
 block/partitions/efi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/partitions/efi.c b/block/partitions/efi.c
index bcd86e5cd546..7b1a62073d34 100644
--- a/block/partitions/efi.c
+++ b/block/partitions/efi.c
@@ -149,8 +149,8 @@ static u64 last_lba(struct block_device *bdev)
 {
 	if (!bdev || !bdev->bd_inode)
 		return 0;
-	return div_u64(bdev->bd_inode->i_size,
-		       bdev_logical_block_size(bdev)) - 1ULL;
+
+	return bdev_logical_block_count(bdev) - 1;
 }
 
 static inline int pmbr_part_valid(gpt_mbr_record *part)
-- 
2.9.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ