Re: [PATCH] ib_umem: fix type mismatch
From: Leon Romanovsky
Date: Sun Sep 08 2019 - 04:10:33 EST
On Fri, Sep 06, 2019 at 05:42:37PM +0200, Arnd Bergmann wrote:
> On some 32-bit architectures, size_t is defined as 'int' rather
> than 'long', causing a harmless warning:
> drivers/infiniband/core/umem_odp.c:220:7: error: comparison of distinct pointer types ('typeof (umem_odp->umem.address) *' (aka 'unsigned long *') and 'typeof (umem_odp->umem.length) *' (aka 'unsigned int *')) [-Werror,-Wcompare-distinct-pointer-types]
> if (check_add_overflow(umem_odp->umem.address,
> include/linux/overflow.h:59:15: note: expanded from macro 'check_add_overflow'
> (void) (&__a == &__b); \
> ~~~~ ^ ~~~~
> As size_t is always the same length as unsigned long in all supported
> architectures, change the structure definition to use the unsigned long
> type for both.
> Fixes: 204e3e5630c5 ("RDMA/odp: Check for overflow when computing the umem_odp end")
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> include/rdma/ib_umem.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
I had slightly different fix in my submission queue, which I think is
better because it leaves length to be size_t.