nbd: fix 64-bit division
authorJens Axboe <axboe@fb.com>
Sat, 3 Dec 2016 19:08:03 +0000 (12:08 -0700)
committerJens Axboe <axboe@fb.com>
Sat, 3 Dec 2016 19:08:03 +0000 (12:08 -0700)
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

index 92f5400edbd36265d69a4607047e19337bd6edb8..bc78cbb2d18aff1d51f5e1f93f752fd2d0cb300b 100644 (file)
@@ -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);