xsk: fix 64-bit division
authorBjörn Töpel <[email protected]>
Mon, 7 May 2018 17:43:50 +0000 (19:43 +0200)
committerDaniel Borkmann <[email protected]>
Wed, 9 May 2018 16:12:21 +0000 (18:12 +0200)
i386 builds report:
  net/xdp/xdp_umem.o: In function `xdp_umem_reg':
  xdp_umem.c:(.text+0x47e): undefined reference to `__udivdi3'

This fix uses div_u64 instead of the GCC built-in.

Fixes: c0c77d8fb787 ("xsk: add user memory registration support sockopt")
Signed-off-by: Björn Töpel <[email protected]>
Reported-by: Randy Dunlap <[email protected]>
Tested-by: Randy Dunlap <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
net/xdp/xdp_umem.c

index 881dfdefe235926b9fe48b1359c67e96f2e06e1b..2b47a1dd7c6c56cb3f97532c193a047cdb650ade 100644 (file)
@@ -209,7 +209,7 @@ int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
        if ((addr + size) < addr)
                return -EINVAL;
 
-       nframes = size / frame_size;
+       nframes = (unsigned int)div_u64(size, frame_size);
        if (nframes == 0 || nframes > UINT_MAX)
                return -EINVAL;