linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nbd: use correct div_s64 helper
@ 2016-03-04 23:49 Arnd Bergmann
  2016-03-05  0:19 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2016-03-04 23:49 UTC (permalink / raw)
  To: Jens Axboe, Markus Pargmann; +Cc: Arnd Bergmann, nbd-general, linux-kernel

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 <arnd@arndb.de>
Fixes: 37091fdd831f ("nbd: Create size change events for userspace")
---
 drivers/block/nbd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index f6b51d76e578..08afbc7a2bb8 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -753,8 +753,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
 	}
 
 	case NBD_SET_BLKSIZE: {
-		loff_t bsize = nbd->bytesize;
-		do_div(bsize, arg);
+		loff_t bsize = div_s64(nbd->bytesize, arg);
 
 		return nbd_size_set(nbd, bdev, arg, bsize);
 	}
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-05  0:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-04 23:49 [PATCH] nbd: use correct div_s64 helper Arnd Bergmann
2016-03-05  0:19 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).