netfilter: xt_hashlimit: Fix link error in 32bit arch because of 64bit division
Subsystems (3)
PATCH v3 1/1 netfilter: xt_hashlimit: Fix link error in 32bit arch because of 64bit division
v2:
Remove unnecessary div64_u64 around constants
v3:
remove backslashes
--
Fix link error in 32bit arch because of 64bit division
Division of 64bit integers will cause linker error undefined reference to `__udivdi3'. Fix this by replacing divisions with div64_64
--- net/netfilter/xt_hashlimit.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
net/netfilter/xt_hashlimit.c +8 -7
@@ -467,17 +467,18 @@ static u64 user2credits(u64 user, int revision)/* If multiplying would overflow... */ if (user >0xFFFFFFFF / (HZ *CREDITS_PER_JIFFY_v1))/* Divide first. */ -return (user /XT_HASHLIMIT_SCALE ) *\ -HZ * CREDITS_PER_JIFFY_v1; +return div64_u64 (user,XT_HASHLIMIT_SCALE ) + *HZ * CREDITS_PER_JIFFY_v1; -return (user *HZ * CREDITS_PER_JIFFY_v1) \ - /XT_HASHLIMIT_SCALE ; +return div64_u64 ((user *HZ * CREDITS_PER_JIFFY_v1), +XT_HASHLIMIT_SCALE ); }else {if (user >0xFFFFFFFFFFFFFFFF / (HZ *CREDITS_PER_JIFFY )) -return (user / XT_HASHLIMIT_SCALE_v2) *\ -HZ *CREDITS_PER_JIFFY ; +return div64_u64 (user, XT_HASHLIMIT_SCALE_v2) + *HZ *CREDITS_PER_JIFFY ; -return (user *HZ *CREDITS_PER_JIFFY ) / XT_HASHLIMIT_SCALE_v2; +return div64_u64 ((user *HZ *CREDITS_PER_JIFFY ), + XT_HASHLIMIT_SCALE_v2); } }
Signature · 1 line
1.9.1
net/netfilter/xt_hashlimit.c static u64 user2credits(u64 user, int revision) · line 474
Quoted 2 lines
net/netfilter/xt_hashlimit.c +2
-0+return div64_u64 ((user *HZ * CREDITS_PER_JIFFY_v1), +XT_HASHLIMIT_SCALE );
spurious ()
net/netfilter/xt_hashlimit.c static u64 user2credits(u64 user, int revision) · line 481
Quoted 2 lines
net/netfilter/xt_hashlimit.c +2
-0+return div64_u64 ((user *HZ *CREDITS_PER_JIFFY ), + XT_HASHLIMIT_SCALE_v2);
spurious ()
but:
Quoted 6 lines · Vishwanath Pai
v2:
Remove unnecessarydiv64_u64around constantsv3:
remove backslashes
Quoted 6 lines
--
Fix link error in 32bit arch because of 64bit division
Division of 64bit integers will cause linker error undefined reference to `__udivdi3'. Fix this by replacing divisions with
div64_64
Applied, thanks Pai.
Quoted 4 lines
Signed-off-by Vishwanath Pai <[email protected]>Fixes 11d5f15723c9 ("netfilter: xt_hashlimit: Create revision 2 to ...")---
Please, next time place the versioning information here, otherwise git am takes the wrong description here.
Quoted 16 lines · Pablo Neira Ayuso
Quoted 6 lines · Vishwanath Pai
v2:
Remove unnecessarydiv64_u64around constantsv3:
remove backslashesQuoted 6 lines
--
Fix link error in 32bit arch because of 64bit division
Division of 64bit integers will cause linker error undefined reference to `__udivdi3'. Fix this by replacing divisions with
div64_64Applied, thanks Pai.
Quoted 8 lines
Quoted 4 lines
Signed-off-by Vishwanath Pai <[email protected]>Fixes 11d5f15723c9 ("netfilter: xt_hashlimit: Create revision 2 to ...")---
Please, next time place the versioning information here, otherwise git am takes the wrong description here.
Thank you. And sorry about, I did not realize git am would put that into the description.
-Vishwanath