Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/811298/?format=api
{ "id": 811298, "url": "http://patchwork.ozlabs.org/api/1.2/patches/811298/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/1504836885-29088-1-git-send-email-vpai@akamai.com/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/1.2/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1504836885-29088-1-git-send-email-vpai@akamai.com>", "list_archive_url": null, "date": "2017-09-08T02:14:45", "name": "netfilter: xt_hashlimit: fix build error caused by 64bit division", "commit_ref": null, "pull_url": null, "state": "awaiting-upstream", "archived": true, "hash": "1388c68312532437998abfc8042194d468f4e455", "submitter": { "id": 66296, "url": "http://patchwork.ozlabs.org/api/1.2/people/66296/?format=api", "name": "Vishwanath Pai", "email": "vpai@akamai.com" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/1.2/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/1504836885-29088-1-git-send-email-vpai@akamai.com/mbox/", "series": [ { "id": 2089, "url": "http://patchwork.ozlabs.org/api/1.2/series/2089/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=2089", "date": "2017-09-08T02:14:45", "name": "netfilter: xt_hashlimit: fix build error caused by 64bit division", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/2089/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/811298/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/811298/checks/", "tags": {}, "related": [], "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>)", "ozlabs.org; dkim=pass (2048-bit key;\n\tsecure) header.d=akamai.com header.i=@akamai.com header.b=\"l4tnUSJq\";\n\tdkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xpLXs4Y4Mz9sQl\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 8 Sep 2017 12:16:29 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1753072AbdIHCQP (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tThu, 7 Sep 2017 22:16:15 -0400", "from mx0a-00190b01.pphosted.com ([67.231.149.131]:42317 \"EHLO\n\tmx0a-00190b01.pphosted.com\" rhost-flags-OK-OK-OK-OK)\n\tby vger.kernel.org with ESMTP id S1750852AbdIHCQN (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Thu, 7 Sep 2017 22:16:13 -0400", "from pps.filterd (m0122333.ppops.net [127.0.0.1])\n\tby mx0a-00190b01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv882CdVw028911; Fri, 8 Sep 2017 03:14:50 +0100", "from prod-mail-ppoint3 ([96.6.114.86])\n\tby mx0a-00190b01.pphosted.com with ESMTP id 2cuhn484t6-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256\n\tverify=NOT); Fri, 08 Sep 2017 03:14:50 +0100", "from pps.filterd (prod-mail-ppoint3.akamai.com [127.0.0.1])\n\tby prod-mail-ppoint3.akamai.com (8.16.0.17/8.16.0.17) with SMTP id\n\tv882BZsN027664; Thu, 7 Sep 2017 22:14:49 -0400", "from prod-mail-relay15.akamai.com ([172.27.17.40])\n\tby prod-mail-ppoint3.akamai.com with ESMTP id 2cqqyw08bv-1;\n\tThu, 07 Sep 2017 22:14:49 -0400", "from bos-lpqrs.kendall.corp.akamai.com\n\t(bos-lpqrs.kendall.corp.akamai.com [172.28.13.81])\n\tby prod-mail-relay15.akamai.com (Postfix) with ESMTP id CCAFF20066;\n\tThu, 7 Sep 2017 20:14:47 -0600 (MDT)", "from vpai by bos-lpqrs.kendall.corp.akamai.com with local (Exim\n\t4.82) (envelope-from <vpai@akamai.com>)\n\tid 1dq8of-0007Zi-Qj; Thu, 07 Sep 2017 22:14:45 -0400" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=akamai.com;\n\th=from : to : cc :\n\tsubject : date : message-id; s=jan2016.eng;\n\tbh=J46niw1JaalKAFjajsbbPhmGRT8keZj+mlHoKN7ik2s=;\n\tb=l4tnUSJqTNQIEG0fy/EWq8/fRvulAm86N0s5UmQ87gTjXSn7ZEDIOfAugTt6bUD2/g4z\n\tWb7KPNwGoaaW/pcMEMwP0xSj1UTvKQs8rirgmEKNLk1NO63K8nisdOoomF+L2dv9yEpb\n\trZFTeCQcSJBNcY8hN51W6a0X9d/hcsbKLOOY7Tt8HqG/kbBgcr6AHU2X3VhvMosS6qBI\n\tq8FUGzV+jpLuTUsQPPrc1KEV9H8adC7LTBUiDS2yy47J1/AvRtv2EA5Qg3ylONj8vf8Q\n\tlERFwf2giKLDLTvx2+/w06kGPQzYD/S6XzQTQ0L1xj3fvg1O3VvnDEKZeD+V21Rm0nzr\n\tVQ== ", "From": "Vishwanath Pai <vpai@akamai.com>", "To": "pablo@netfilter.org, netfilter-devel@vger.kernel.org,\n\ttorvalds@linux-foundation.org, davem@davemloft.net", "Cc": "kadlec@blackhole.kfki.hu, johunt@akamai.com, fw@strlen.de,\n\tnetdev@vger.kernel.org, pai.vishwain@gmail.com, mingo@kernel.org,\n\tilubashe@akamai.com, bp@alien8.de, luto@kernel.org, x86@kernel.org,\n\tlinux-kernel@vger.kernel.org, brgerst@gmail.com,\n\tandrew.cooper3@citrix.com, jgross@suse.com,\n\tboris.ostrovsky@oracle.com, keescook@chromium.org,\n\takpm@linux-foundation.org, arnd@arndb.de", "Subject": "[PATCH] netfilter: xt_hashlimit: fix build error caused by 64bit\n\tdivision", "Date": "Thu, 7 Sep 2017 22:14:45 -0400", "Message-Id": "<1504836885-29088-1-git-send-email-vpai@akamai.com>", "X-Mailer": "git-send-email 1.9.1", "X-Proofpoint-Virus-Version": [ "vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-09-08_01:, , signatures=0", "vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-09-08_02:, , signatures=0" ], "X-Proofpoint-Spam-Details": [ "rule=notspam policy=default score=0 spamscore=0\n\tsuspectscore=0\n\tmalwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam\n\tadjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000\n\tdefinitions=main-1709080031", "rule=notspam policy=default score=0\n\tpriorityscore=1501 malwarescore=0\n\tsuspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011\n\tlowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam\n\tadjust=0\n\treason=mlx scancount=1 engine=8.0.1-1707230000\n\tdefinitions=main-1709080031" ], "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "64bit division causes build/link errors on 32bit architectures. It\nprints out error messages like:\n\nERROR: \"__aeabi_uldivmod\" [net/netfilter/xt_hashlimit.ko] undefined!\n\nThe value of avg passed through by userspace in BYTE mode cannot exceed\nU32_MAX. Which means 64bit division in user2rate_bytes is unnecessary.\n\nThis fix changes the size of both the param as well as return type on\nuser2rate_bytes to u32.\n\nSince anything greater than U32_MAX is an invalid input we error out in\nhashlimit_mt_check_common() when this is the case.\n\nAlso fixed warning about const pointer conversion in cfg_copy().\n\nFixes: bea74641e378 (\"netfilter: xt_hashlimit: add rate match mode\")\nSigned-off-by: Vishwanath Pai <vpai@akamai.com>\n---\n net/netfilter/xt_hashlimit.c | 14 ++++++++------\n 1 file changed, 8 insertions(+), 6 deletions(-)", "diff": "diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c\nindex 10d4823..1d818f1 100644\n--- a/net/netfilter/xt_hashlimit.c\n+++ b/net/netfilter/xt_hashlimit.c\n@@ -35,6 +35,7 @@\n #include <linux/netfilter_ipv6/ip6_tables.h>\n #include <linux/netfilter/xt_hashlimit.h>\n #include <linux/mutex.h>\n+#include <linux/kernel.h>\n \n MODULE_LICENSE(\"GPL\");\n MODULE_AUTHOR(\"Harald Welte <laforge@netfilter.org>\");\n@@ -527,12 +528,12 @@ static u64 user2rate(u64 user)\n \t}\n }\n \n-static u64 user2rate_bytes(u64 user)\n+static u32 user2rate_bytes(u32 user)\n {\n-\tu64 r;\n+\tu32 r;\n \n-\tr = user ? 0xFFFFFFFFULL / user : 0xFFFFFFFFULL;\n-\tr = (r - 1) << 4;\n+\tr = user ? U32_MAX / user : U32_MAX;\n+\tr = (r - 1) << XT_HASHLIMIT_BYTE_SHIFT;\n \treturn r;\n }\n \n@@ -588,7 +589,8 @@ static void rateinfo_init(struct dsthash_ent *dh,\n \t\tdh->rateinfo.prev_window = 0;\n \t\tdh->rateinfo.current_rate = 0;\n \t\tif (hinfo->cfg.mode & XT_HASHLIMIT_BYTES) {\n-\t\t\tdh->rateinfo.rate = user2rate_bytes(hinfo->cfg.avg);\n+\t\t\tdh->rateinfo.rate =\n+\t\t\t\tuser2rate_bytes((u32)hinfo->cfg.avg);\n \t\t\tif (hinfo->cfg.burst)\n \t\t\t\tdh->rateinfo.burst =\n \t\t\t\t\thinfo->cfg.burst * dh->rateinfo.rate;\n@@ -870,7 +872,7 @@ static int hashlimit_mt_check_common(const struct xt_mtchk_param *par,\n \n \t/* Check for overflow. */\n \tif (revision >= 3 && cfg->mode & XT_HASHLIMIT_RATE_MATCH) {\n-\t\tif (cfg->avg == 0) {\n+\t\tif (cfg->avg == 0 || cfg->avg > U32_MAX) {\n \t\t\tpr_info(\"hashlimit invalid rate\\n\");\n \t\t\treturn -ERANGE;\n \t\t}\n", "prefixes": [] }