Skip to content

Commit 5e454c6

Browse files
arndbaxboe
authored andcommitted
nbd: use correct div_s64 helper
The do_div() macro now checks its arguments for the correct type, and refuses anything other than u64, so we get a warning about nbd_ioctl passing in an loff_t: drivers/block/nbd.c: In function '__nbd_ioctl': drivers/block/nbd.c:757:77: error: comparison of distinct pointer types lacks a cast [-Werror] This changes the nbd code to use div_s64() instead, which takes a signed argument. Signed-off-by: Arnd Bergmann <[email protected]> Fixes: 37091fd ("nbd: Create size change events for userspace") Signed-off-by: Jens Axboe <[email protected]>
1 parent 90beb2e commit 5e454c6

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/block/nbd.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,8 +753,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
753753
}
754754

755755
case NBD_SET_BLKSIZE: {
756-
loff_t bsize = nbd->bytesize;
757-
do_div(bsize, arg);
756+
loff_t bsize = div_s64(nbd->bytesize, arg);
758757

759758
return nbd_size_set(nbd, bdev, arg, bsize);
760759
}

0 commit comments

Comments
 (0)