Skip to contentSkip to conversation

RDMA/odp: Add missing cast for 32 bit

PATCH Applied Leon Romanovsky 2 participants 2 messages Sep 8, 2019 – Sep 12, 2019 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/odp: Add missing cast for 32 bit

From: Jason Gunthorpe <[email protected]>

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")
---
 drivers/infiniband/core/umem_odp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/umem_odp.c +1 -1
index 32fb0b579dec..bd01c77aeef0 100644
@@ -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 =
Signature · 1 line
2.20.1
#1 lore raw
Quoted 10 lines · Leon Romanovsky

From: Jason Gunthorpe <[email protected]>

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'

Quoted 6 lines
Fixes 204e3e5630c5 ("RDMA/odp: Check for overflow when computing the umem_odp end")
---
 drivers/infiniband/core/umem_odp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-next

Jason