[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170908125635.GA27811@salvia>
Date: Fri, 8 Sep 2017 14:56:35 +0200
From: Pablo Neira Ayuso <pablo@...filter.org>
To: Vishwanath Pai <vpai@...mai.com>
Cc: netfilter-devel@...r.kernel.org, torvalds@...ux-foundation.org,
davem@...emloft.net, kadlec@...ckhole.kfki.hu, johunt@...mai.com,
fw@...len.de, netdev@...r.kernel.org, pai.vishwain@...il.com,
mingo@...nel.org, ilubashe@...mai.com, bp@...en8.de,
luto@...nel.org, x86@...nel.org, linux-kernel@...r.kernel.org,
brgerst@...il.com, andrew.cooper3@...rix.com, jgross@...e.com,
boris.ostrovsky@...cle.com, keescook@...omium.org,
akpm@...ux-foundation.org, arnd@...db.de
Subject: Re: [PATCH v2] netfilter: xt_hashlimit: fix build error caused by
64bit division
On Fri, Sep 08, 2017 at 01:38:58AM -0400, Vishwanath Pai wrote:
> 64bit division causes build/link errors on 32bit architectures. It
> prints out error messages like:
>
> ERROR: "__aeabi_uldivmod" [net/netfilter/xt_hashlimit.ko] undefined!
>
> The value of avg passed through by userspace in BYTE mode cannot exceed
> U32_MAX. Which means 64bit division in user2rate_bytes is unnecessary.
> To fix this I have changed the type of param 'user' to u32.
>
> Since anything greater than U32_MAX is an invalid input we error out in
> hashlimit_mt_check_common() when this is the case.
>
> Changes in v2:
> Making return type as u32 would cause an overflow for small
> values of 'user' (for example 2, 3 etc). To avoid this I bumped up
> 'r' to u64 again as well as the return type. This is OK since the
> variable that stores the result is u64. We still avoid 64bit
> division here since 'user' is u32.
Applied, thanks.
Powered by blists - more mailing lists