Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Björn Töpel and committed by
Daniel Borkmann
ea7e3435 a46a5c1a

+1 -1
+1 -1
net/xdp/xdp_umem.c
··· 209 209 if ((addr + size) < addr) 210 210 return -EINVAL; 211 211 212 - nframes = size / frame_size; 212 + nframes = (unsigned int)div_u64(size, frame_size); 213 213 if (nframes == 0 || nframes > UINT_MAX) 214 214 return -EINVAL; 215 215