On Wed, 2012-07-04 at 15:49 +0800, wfg@xxxxxxxxxxxxxxx wrote: > Hi Nicholas, > > There are new compile warnings show up in > > tree: git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git tcm_vhost > head: 5d79da8394584e86a30d718bc0b10278d2c9a939 > commit: b454f58bed99193cd150a31622455bf93aa7cfc5 [23/24] tcm_vhost: Initial merge for vhost level target fabric driver > > All warnings: > > drivers/vhost/tcm_vhost.c: In function 'vhost_scsi_map_to_sgl': > drivers/vhost/tcm_vhost.c:535:25: warning: comparison of distinct pointer types lacks a cast [enabled by default] > drivers/vhost/tcm_vhost.c: In function 'vhost_scsi_handle_vq': > drivers/vhost/tcm_vhost.c:682:3: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Wformat] > > vim +535 drivers/vhost/tcm_vhost.c > 532 while (len > 0) { > 533 struct page *page; > 534 unsigned int offset = (uintptr_t)ptr & ~PAGE_MASK; > > 535 unsigned int nbytes = min(PAGE_SIZE - offset, len); > 536 > 537 if (npages == sgl_count) { > 538 ret = -ENOBUFS; > <nod>, fixed up these sparse warnings the following patch for target-pending/tcm-vhost. Thank you. --nab diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c index 3dded7b..81b77f3 100644 --- a/drivers/vhost/tcm_vhost.c +++ b/drivers/vhost/tcm_vhost.c @@ -534,7 +534,8 @@ static int vhost_scsi_map_to_sgl(struct scatterlist *sgl, while (len > 0) { struct page *page; unsigned int offset = (uintptr_t)ptr & ~PAGE_MASK; - unsigned int nbytes = min(PAGE_SIZE - offset, len); + unsigned int nbytes = min_t(unsigned int, + PAGE_SIZE - offset, len); if (npages == sgl_count) { ret = -ENOBUFS; @@ -681,7 +682,7 @@ static void vhost_scsi_handle_vq(struct vhost_scsi *vs) vq->iov[0].iov_len); break; } - pr_debug("Calling __copy_from_user: vq->iov[0].iov_base: %p, len: %lu\n", + pr_debug("Calling __copy_from_user: vq->iov[0].iov_base: %p, len: %zu\n", vq->iov[0].iov_base, sizeof(v_req)); ret = __copy_from_user(&v_req, vq->iov[0].iov_base, sizeof(v_req)); if (unlikely(ret)) { -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html