提交 5e454c67 编写于 作者: A Arnd Bergmann 提交者: Jens Axboe

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: NArnd Bergmann <arnd@arndb.de>
Fixes: 37091fdd ("nbd: Create size change events for userspace")
Signed-off-by: NJens Axboe <axboe@fb.com>
上级 90beb2e7
...@@ -753,8 +753,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd, ...@@ -753,8 +753,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
} }
case NBD_SET_BLKSIZE: { case NBD_SET_BLKSIZE: {
loff_t bsize = nbd->bytesize; loff_t bsize = div_s64(nbd->bytesize, arg);
do_div(bsize, arg);
return nbd_size_set(nbd, bdev, arg, bsize); return nbd_size_set(nbd, bdev, arg, bsize);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册