* [PATCH] netfilter: xt_hashlimit: Add missing ULL suffixes for 64-bit constants
@ 2016-10-06 13:40 Geert Uytterhoeven
2016-10-06 16:40 ` Vishwanath Pai
0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2016-10-06 13:40 UTC (permalink / raw)
To: Pablo Neira Ayuso, Patrick McHardy, Jozsef Kadlecsik,
David S. Miller, Vishwanath Pai, Joshua Hunt
Cc: netfilter-devel, coreteam, netdev, linux-kernel, Geert Uytterhoeven
On 32-bit (e.g. with m68k-linux-gnu-gcc-4.1):
net/netfilter/xt_hashlimit.c: In function ‘user2credits’:
net/netfilter/xt_hashlimit.c:476: warning: integer constant is too large for ‘long’ type
...
net/netfilter/xt_hashlimit.c:478: warning: integer constant is too large for ‘long’ type
...
net/netfilter/xt_hashlimit.c:480: warning: integer constant is too large for ‘long’ type
...
net/netfilter/xt_hashlimit.c: In function ‘rateinfo_recalc’:
net/netfilter/xt_hashlimit.c:513: warning: integer constant is too large for ‘long’ type
Fixes: 11d5f15723c9f39d ("netfilter: xt_hashlimit: Create revision 2 to support higher pps rates")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
net/netfilter/xt_hashlimit.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 2fab0c65aa94b666..b89b688e9d01a2d1 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -431,7 +431,7 @@ static void htable_put(struct xt_hashlimit_htable *hinfo)
CREDITS_PER_JIFFY*HZ*60*60*24 < 2^32 ie.
*/
#define MAX_CPJ_v1 (0xFFFFFFFF / (HZ*60*60*24))
-#define MAX_CPJ (0xFFFFFFFFFFFFFFFF / (HZ*60*60*24))
+#define MAX_CPJ (0xFFFFFFFFFFFFFFFFULL / (HZ*60*60*24))
/* Repeated shift and or gives us all 1s, final shift and add 1 gives
* us the power of 2 below the theoretical max, so GCC simply does a
@@ -473,7 +473,7 @@ static u64 user2credits(u64 user, int revision)
return div64_u64(user * HZ * CREDITS_PER_JIFFY_v1,
XT_HASHLIMIT_SCALE);
} else {
- if (user > 0xFFFFFFFFFFFFFFFF / (HZ*CREDITS_PER_JIFFY))
+ if (user > 0xFFFFFFFFFFFFFFFFULL / (HZ*CREDITS_PER_JIFFY))
return div64_u64(user, XT_HASHLIMIT_SCALE_v2)
* HZ * CREDITS_PER_JIFFY;
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] netfilter: xt_hashlimit: Add missing ULL suffixes for 64-bit constants
2016-10-06 13:40 [PATCH] netfilter: xt_hashlimit: Add missing ULL suffixes for 64-bit constants Geert Uytterhoeven
@ 2016-10-06 16:40 ` Vishwanath Pai
0 siblings, 0 replies; 2+ messages in thread
From: Vishwanath Pai @ 2016-10-06 16:40 UTC (permalink / raw)
To: Geert Uytterhoeven, Pablo Neira Ayuso
Cc: Patrick McHardy, Jozsef Kadlecsik, David S. Miller, Joshua Hunt,
netfilter-devel, coreteam, netdev, linux-kernel
On 10/06/2016 09:40 AM, Geert Uytterhoeven wrote:
> diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
> index 2fab0c65aa94b666..b89b688e9d01a2d1 100644
> --- a/net/netfilter/xt_hashlimit.c
> +++ b/net/netfilter/xt_hashlimit.c
> @@ -431,7 +431,7 @@ static void htable_put(struct xt_hashlimit_htable *hinfo)
> CREDITS_PER_JIFFY*HZ*60*60*24 < 2^32 ie.
> */
> #define MAX_CPJ_v1 (0xFFFFFFFF / (HZ*60*60*24))
> -#define MAX_CPJ (0xFFFFFFFFFFFFFFFF / (HZ*60*60*24))
> +#define MAX_CPJ (0xFFFFFFFFFFFFFFFFULL / (HZ*60*60*24))
>
> /* Repeated shift and or gives us all 1s, final shift and add 1 gives
> * us the power of 2 below the theoretical max, so GCC simply does a
> @@ -473,7 +473,7 @@ static u64 user2credits(u64 user, int revision)
> return div64_u64(user * HZ * CREDITS_PER_JIFFY_v1,
> XT_HASHLIMIT_SCALE);
> } else {
> - if (user > 0xFFFFFFFFFFFFFFFF / (HZ*CREDITS_PER_JIFFY))
> + if (user > 0xFFFFFFFFFFFFFFFFULL / (HZ*CREDITS_PER_JIFFY))
> return div64_u64(user, XT_HASHLIMIT_SCALE_v2)
> * HZ * CREDITS_PER_JIFFY;
>
> -- 1.9.1
Thanks for fixing this.
Acked-by: Vishwanath Pai <vpai@akamai.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-06 16:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-06 13:40 [PATCH] netfilter: xt_hashlimit: Add missing ULL suffixes for 64-bit constants Geert Uytterhoeven
2016-10-06 16:40 ` Vishwanath Pai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.