nbd: fix 64-bit division

This commit is contained in:
Roger Shimizu 2017-01-24 21:35:14 +09:00
parent 3ed01076a0
commit 7a613e23af
3 changed files with 35 additions and 0 deletions

1
debian/changelog vendored
View File

@ -371,6 +371,7 @@ linux (4.9.5-1) UNRELEASED; urgency=medium
* drivers/input: Enable TOUCHSCREEN_GOODIX as module (Closes: #851821).
* [mips/octeon] hwmon: Enable SENSORS_ADM1031 as module (Closes: #851963).
Thanks to James Cowgill.
* nbd: fix 64-bit division.
-- Salvatore Bonaccorso <carnil@debian.org> Mon, 16 Jan 2017 09:26:13 +0100

View File

@ -0,0 +1,33 @@
From: Jens Axboe <axboe@fb.com>
Date: Sat, 3 Dec 2016 12:08:03 -0700
Subject: [PATCH] nbd: fix 64-bit division
Origin: https://git.kernel.org/linus/e88f72cb9f54f6d244e55f629fe5e2f34ca6f9ed
We have this:
ERROR: "__aeabi_ldivmod" [drivers/block/nbd.ko] undefined!
ERROR: "__divdi3" [drivers/block/nbd.ko] undefined!
nbd.c:(.text+0x247c72): undefined reference to `__divdi3'
due to a recent commit, that did 64-bit division. Use the proper
divider function so that 32-bit compiles don't break.
Fixes: ef77b515243b ("nbd: use loff_t for blocksize and nbd_set_size args")
Signed-off-by: Jens Axboe <axboe@fb.com>
---
drivers/block/nbd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 92f5400edbd3..bc78cbb2d18a 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -729,7 +729,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
case NBD_SET_SIZE:
return nbd_size_set(nbd, bdev, nbd->blksize,
- arg / nbd->blksize);
+ div_s64(arg, nbd->blksize));
case NBD_SET_SIZE_BLOCKS:
return nbd_size_set(nbd, bdev, nbd->blksize, arg);

View File

@ -69,6 +69,7 @@ bugfix/all/mm-memcontrol-use-special-workqueue-for-creating-per-memcg-caches.pat
bugfix/all/partially-revert-usb-kconfig-using-select-for-usb_co.patch
bugfix/all/nbd-use-loff_t-for-blocksize-and-nbd_set_size-args.patch
bugfix/all/ath9k-fix-null-pointer-dereference.patch
bugfix/all/nbd-fix-64-bit-division.patch
# Miscellaneous features