[{"id":1765318,"web_url":"http://patchwork.ozlabs.org/comment/1765318/","msgid":"<20170908125635.GA27811@salvia>","list_archive_url":null,"date":"2017-09-08T12:56:35","subject":"Re: [PATCH v2] netfilter: xt_hashlimit: fix build error caused by\n\t64bit division","submitter":{"id":1315,"url":"http://patchwork.ozlabs.org/api/people/1315/","name":"Pablo Neira Ayuso","email":"pablo@netfilter.org"},"content":"On Fri, Sep 08, 2017 at 01:38:58AM -0400, Vishwanath Pai wrote:\n> 64bit division causes build/link errors on 32bit architectures. It\n> prints out error messages like:\n> \n> ERROR: \"__aeabi_uldivmod\" [net/netfilter/xt_hashlimit.ko] undefined!\n> \n> The value of avg passed through by userspace in BYTE mode cannot exceed\n> U32_MAX. Which means 64bit division in user2rate_bytes is unnecessary.\n> To fix this I have changed the type of param 'user' to u32.\n> \n> Since anything greater than U32_MAX is an invalid input we error out in\n> hashlimit_mt_check_common() when this is the case.\n> \n> Changes in v2:\n> \tMaking return type as u32 would cause an overflow for small\n> \tvalues of 'user' (for example 2, 3 etc). To avoid this I bumped up\n> \t'r' to u64 again as well as the return type. This is OK since the\n> \tvariable that stores the result is u64. We still avoid 64bit\n> \tdivision here since 'user' is u32.\n\nApplied, thanks.","headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xpcmL0zdFz9s71\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri,  8 Sep 2017 22:57:21 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1755747AbdIHM5H (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 8 Sep 2017 08:57:07 -0400","from ganesha.gnumonks.org ([213.95.27.120]:34980 \"EHLO\n\tganesha.gnumonks.org\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1755013AbdIHM5G (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Fri, 8 Sep 2017 08:57:06 -0400","from 129.166.216.87.static.jazztel.es ([87.216.166.129]\n\thelo=gnumonks.org) by ganesha.gnumonks.org with esmtpsa\n\t(TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2)\n\t(envelope-from <pablo@gnumonks.org>)\n\tid 1dqIpo-0005Fr-6K; Fri, 08 Sep 2017 14:56:38 +0200"],"Date":"Fri, 8 Sep 2017 14:56:35 +0200","From":"Pablo Neira Ayuso <pablo@netfilter.org>","To":"Vishwanath Pai <vpai@akamai.com>","Cc":"netfilter-devel@vger.kernel.org, torvalds@linux-foundation.org,\n\tdavem@davemloft.net, kadlec@blackhole.kfki.hu, johunt@akamai.com,\n\tfw@strlen.de, netdev@vger.kernel.org, pai.vishwain@gmail.com,\n\tmingo@kernel.org, ilubashe@akamai.com, bp@alien8.de,\n\tluto@kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org,\n\tbrgerst@gmail.com, andrew.cooper3@citrix.com, jgross@suse.com,\n\tboris.ostrovsky@oracle.com, keescook@chromium.org,\n\takpm@linux-foundation.org, arnd@arndb.de","Subject":"Re: [PATCH v2] netfilter: xt_hashlimit: fix build error caused by\n\t64bit division","Message-ID":"<20170908125635.GA27811@salvia>","References":"<1504849138-17427-1-git-send-email-vpai@akamai.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<1504849138-17427-1-git-send-email-vpai@akamai.com>","User-Agent":"Mutt/1.5.23 (2014-03-12)","X-Spam-Score":"-2.9 (--)","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"}}]