Linux-RDMA Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH rdma-next] RDMA/odp: Add missing cast for 32 bit
@ 2019-09-08  8:07 Leon Romanovsky
  2019-09-12 13:39 ` Jason Gunthorpe
  0 siblings, 1 reply; 2+ messages in thread
From: Leon Romanovsky @ 2019-09-08  8:07 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe
  Cc: RDMA mailing list, Jason Gunthorpe, Leon Romanovsky

From: Jason Gunthorpe <jgg@mellanox.com>

length is a size_t which is unsigned int on 32 bit:

../drivers/infiniband/core/umem_odp.c: In function 'ib_init_umem_odp':
../include/linux/overflow.h:59:15: warning: comparison of distinct pointer types lacks a cast
   59 |  (void) (&__a == &__b);   \
      |               ^~
../drivers/infiniband/core/umem_odp.c:220:7: note: in expansion of macro 'check_add_overflow'

Fixes: 204e3e5630c5 ("RDMA/odp: Check for overflow when computing the umem_odp end")
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/core/umem_odp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/umem_odp.c b/drivers/infiniband/core/umem_odp.c
index 32fb0b579dec..bd01c77aeef0 100644
--- a/drivers/infiniband/core/umem_odp.c
+++ b/drivers/infiniband/core/umem_odp.c
@@ -293,7 +293,7 @@ static inline int ib_init_umem_odp(struct ib_umem_odp *umem_odp,
 		umem_odp->interval_tree.start =
 			ALIGN_DOWN(umem_odp->umem.address, page_size);
 		if (check_add_overflow(umem_odp->umem.address,
-				       umem_odp->umem.length,
+				       (unsigned long)umem_odp->umem.length,
 				       &umem_odp->interval_tree.last))
 			return -EOVERFLOW;
 		umem_odp->interval_tree.last =
-- 
2.20.1


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

* Re: [PATCH rdma-next] RDMA/odp: Add missing cast for 32 bit
  2019-09-08  8:07 [PATCH rdma-next] RDMA/odp: Add missing cast for 32 bit Leon Romanovsky
@ 2019-09-12 13:39 ` Jason Gunthorpe
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2019-09-12 13:39 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: Doug Ledford, RDMA mailing list, Leon Romanovsky

On Sun, Sep 08, 2019 at 11:07:26AM +0300, Leon Romanovsky wrote:
> From: Jason Gunthorpe <jgg@mellanox.com>
> 
> length is a size_t which is unsigned int on 32 bit:
> 
> ../drivers/infiniband/core/umem_odp.c: In function 'ib_init_umem_odp':
> ../include/linux/overflow.h:59:15: warning: comparison of distinct pointer types lacks a cast
>    59 |  (void) (&__a == &__b);   \
>       |               ^~
> ../drivers/infiniband/core/umem_odp.c:220:7: note: in expansion of macro 'check_add_overflow'
> 
> Fixes: 204e3e5630c5 ("RDMA/odp: Check for overflow when computing the umem_odp end")
> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> ---
>  drivers/infiniband/core/umem_odp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-next

Jason

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-08  8:07 [PATCH rdma-next] RDMA/odp: Add missing cast for 32 bit Leon Romanovsky
2019-09-12 13:39 ` Jason Gunthorpe

Linux-RDMA Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-rdma/0 linux-rdma/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-rdma linux-rdma/ https://lore.kernel.org/linux-rdma \
		linux-rdma@vger.kernel.org linux-rdma@archiver.kernel.org
	public-inbox-index linux-rdma

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-rdma


AGPL code for this site: git clone https://public-inbox.org/ public-inbox