Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/57295/?format=api
http://patchwork.dpdk.org/api/patches/57295/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20190730213920.17225-1-aconole@redhat.com/", "project": { "id": 1, "url": "http://patchwork.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20190730213920.17225-1-aconole@redhat.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20190730213920.17225-1-aconole@redhat.com", "date": "2019-07-30T21:39:20", "name": "librte_acl: fix undefined behavior", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "c9684e34d25b9500754b95a6693fa14f975053bd", "submitter": { "id": 332, "url": "http://patchwork.dpdk.org/api/people/332/?format=api", "name": "Aaron Conole", "email": "aconole@redhat.com" }, "delegate": null, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20190730213920.17225-1-aconole@redhat.com/mbox/", "series": [ { "id": 5843, "url": "http://patchwork.dpdk.org/api/series/5843/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=5843", "date": "2019-07-30T21:39:20", "name": "librte_acl: fix undefined behavior", "version": 1, "mbox": "http://patchwork.dpdk.org/series/5843/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/57295/comments/", "check": "success", "checks": "http://patchwork.dpdk.org/api/patches/57295/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id ACF741C030;\n\tTue, 30 Jul 2019 23:39:23 +0200 (CEST)", "from mx1.redhat.com (mx1.redhat.com [209.132.183.28])\n\tby dpdk.org (Postfix) with ESMTP id 819D01C012\n\tfor <dev@dpdk.org>; Tue, 30 Jul 2019 23:39:22 +0200 (CEST)", "from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id DB7553082E57;\n\tTue, 30 Jul 2019 21:39:21 +0000 (UTC)", "from dhcp-25.97.bos.redhat.com (unknown [10.18.25.67])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 6B63660BEC;\n\tTue, 30 Jul 2019 21:39:21 +0000 (UTC)" ], "From": "Aaron Conole <aconole@redhat.com>", "To": "dev@dpdk.org", "Cc": "Konstantin Ananyev <konstantin.ananyev@intel.com>,\n\tPablo de Lara Guarch <pablo.de.lara.guarch@intel.com>", "Date": "Tue, 30 Jul 2019 17:39:20 -0400", "Message-Id": "<20190730213920.17225-1-aconole@redhat.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.12", "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.46]); Tue, 30 Jul 2019 21:39:21 +0000 (UTC)", "Subject": "[dpdk-dev] [PATCH] librte_acl: fix undefined behavior", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Left-shift of an integer constant is represented as 'int' type, but a left\nshift of 1 by 31 bits in 'int' is undefined. Use the U suffix to force\na representation as unsigned.\n\nCaught while running with ubsan under gcc.\n\nFixes: dc276b5780c2 (\"acl: new library\")\nCc: Konstantin Ananyev <konstantin.ananyev@intel.com>\nSigned-off-by: Aaron Conole <aconole@redhat.com>\n---\nI could have changed the sizeof(bits_t) * 8 in the bitset.bits as well during\nthe cleanup, but chose not to to keep the change minimal.\n\n lib/librte_acl/acl_bld.c | 6 +++---\n lib/librte_acl/acl_gen.c | 4 ++--\n 2 files changed, 5 insertions(+), 5 deletions(-)", "diff": "diff --git a/lib/librte_acl/acl_bld.c b/lib/librte_acl/acl_bld.c\nindex b82191f42..9d27c0a5a 100644\n--- a/lib/librte_acl/acl_bld.c\n+++ b/lib/librte_acl/acl_bld.c\n@@ -320,7 +320,7 @@ acl_add_ptr_range(struct acl_build_context *context,\n \tfor (n = 0; n < UINT8_MAX + 1; n++)\n \t\tif (n >= low && n <= high)\n \t\t\tbitset.bits[n / (sizeof(bits_t) * 8)] |=\n-\t\t\t\t1 << (n % (sizeof(bits_t) * 8));\n+\t\t\t\t1U << (n % (sizeof(bits_t) * CHAR_BIT));\n \n \treturn acl_add_ptr(context, root, node, &bitset);\n }\n@@ -343,7 +343,7 @@ acl_gen_mask(struct rte_acl_bitset *bitset, uint32_t value, uint32_t mask)\n \t\tif ((n & mask) == value) {\n \t\t\trange++;\n \t\t\tbitset->bits[n / (sizeof(bits_t) * 8)] |=\n-\t\t\t\t1 << (n % (sizeof(bits_t) * 8));\n+\t\t\t\t1U << (n % (sizeof(bits_t) * CHAR_BIT));\n \t\t}\n \t}\n \treturn range;\n@@ -972,7 +972,7 @@ build_trie(struct acl_build_context *context, struct rte_acl_build_rule *head,\n \t\t\t\tsizeof(*end->mrt));\n \n \t\tfor (m = context->cfg.num_categories; 0 != m--; ) {\n-\t\t\tif (rule->f->data.category_mask & (1 << m)) {\n+\t\t\tif (rule->f->data.category_mask & (1U << m)) {\n \t\t\t\tend->mrt->results[m] = rule->f->data.userdata;\n \t\t\t\tend->mrt->priority[m] = rule->f->data.priority;\n \t\t\t} else {\ndiff --git a/lib/librte_acl/acl_gen.c b/lib/librte_acl/acl_gen.c\nindex 35a0140b4..81dec3aa6 100644\n--- a/lib/librte_acl/acl_gen.c\n+++ b/lib/librte_acl/acl_gen.c\n@@ -133,7 +133,7 @@ acl_node_fill_dfa(const struct rte_acl_node *node,\n \t\tfor (n = 0; n < RTE_ACL_DFA_SIZE; n++) {\n \n \t\t\tif (bits->bits[n / (sizeof(bits_t) * CHAR_BIT)] &\n-\t\t\t\t(1 << (n % (sizeof(bits_t) * CHAR_BIT)))) {\n+\t\t\t\t(1U << (n % (sizeof(bits_t) * CHAR_BIT)))) {\n \n \t\t\t\tdfa[n] = resolved ? child->node_index : x;\n \t\t\t\tranges += (last_bit == 0);\n@@ -175,7 +175,7 @@ acl_count_sequential_groups(struct rte_acl_bitset *bits, int zero_one)\n \t}\n \tfor (n = 0; n < QRANGE_MIN; n++) {\n \t\tif (bits->bits[n / (sizeof(bits_t) * 8)] &\n-\t\t\t\t(1 << (n % (sizeof(bits_t) * 8)))) {\n+\t\t\t\t(1U << (n % (sizeof(bits_t) * 8)))) {\n \t\t\tif (zero_one == 1 && last_bit != 1)\n \t\t\t\tranges++;\n \t\t\tlast_bit = 1;\n", "prefixes": [] }{ "id": 57295, "url": "