浏览代码

xsk: fix 64-bit division

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 <bjorn.topel@intel.com>
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Björn Töpel 7 年之前
父节点
当前提交
ea7e343529
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      net/xdp/xdp_umem.c

+ 1 - 1
net/xdp/xdp_umem.c

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