get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/139219/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 139219,
    "url": "http://patches.dpdk.org/api/patches/139219/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20240410152101.3211244-2-luca.vizzarro@arm.com/",
    "project": {
        "id": 1,
        "url": "http://patches.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": "<20240410152101.3211244-2-luca.vizzarro@arm.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240410152101.3211244-2-luca.vizzarro@arm.com",
    "date": "2024-04-10T15:21:01",
    "name": "[1/1] vhost: fix GCC 13 build error",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "38754b5623f262244febf9ff41909206d77ec6cc",
    "submitter": {
        "id": 3197,
        "url": "http://patches.dpdk.org/api/people/3197/?format=api",
        "name": "Luca Vizzarro",
        "email": "luca.vizzarro@arm.com"
    },
    "delegate": {
        "id": 2642,
        "url": "http://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20240410152101.3211244-2-luca.vizzarro@arm.com/mbox/",
    "series": [
        {
            "id": 31715,
            "url": "http://patches.dpdk.org/api/series/31715/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=31715",
            "date": "2024-04-10T15:21:00",
            "name": "fix GCC 13 build errors on 32-bit targets",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/31715/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/139219/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/139219/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id AC3A143E37;\n\tWed, 10 Apr 2024 17:22:54 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 3E3FB4069D;\n\tWed, 10 Apr 2024 17:22:49 +0200 (CEST)",
            "from foss.arm.com (foss.arm.com [217.140.110.172])\n by mails.dpdk.org (Postfix) with ESMTP id AD2704021E;\n Wed, 10 Apr 2024 17:22:46 +0200 (CEST)",
            "from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])\n by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E65891480;\n Wed, 10 Apr 2024 08:23:15 -0700 (PDT)",
            "from localhost.localdomain (FVFG51LCQ05N.cambridge.arm.com\n [10.1.32.34])\n by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 50C823F766;\n Wed, 10 Apr 2024 08:22:45 -0700 (PDT)"
        ],
        "From": "Luca Vizzarro <luca.vizzarro@arm.com>",
        "To": "dev@dpdk.org",
        "Cc": "luca.boccassi@gmail.com, paul.szczepanek@arm.com, nick.connolly@arm.com,\n Luca Vizzarro <luca.vizzarro@arm.com>, stable@dpdk.org",
        "Subject": "[PATCH 1/1] vhost: fix GCC 13 build error",
        "Date": "Wed, 10 Apr 2024 16:21:01 +0100",
        "Message-Id": "<20240410152101.3211244-2-luca.vizzarro@arm.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20240410152101.3211244-1-luca.vizzarro@arm.com>",
        "References": "<20240410152101.3211244-1-luca.vizzarro@arm.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <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 <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "This patch resolves a build error with GCC 13 and arm/aarch32 as\ntargets:\n\nIn function ‘mbuf_to_desc’,\n    inlined from ‘vhost_enqueue_async_packed’ at\n      ../lib/vhost/virtio_net.c:1828:6,\n    inlined from ‘virtio_dev_rx_async_packed’ at\n      ../lib/vhost/virtio_net.c:1842:6,\n    inlined from ‘virtio_dev_rx_async_submit_packed’ at\n      ../lib/vhost/virtio_net.c:1900:7:\n../lib/vhost/virtio_net.c:1159:18: error: ‘buf_vec[0].buf_addr’ may\n    be used uninitialized [-Werror=maybe-uninitialized]\n 1159 |         buf_addr = buf_vec[vec_idx].buf_addr;\n      |         ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~\n<snip>\n../lib/vhost/virtio_net.c:1160:18: error: ‘buf_vec[0].buf_iova’ may\n    be used uninitialized [-Werror=maybe-uninitialized]\n 1160 |         buf_iova = buf_vec[vec_idx].buf_iova;\n      |         ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~\n<snip>\n../lib/vhost/virtio_net.c:1161:35: error: ‘buf_vec[0].buf_len’ may\n    be used uninitialized [-Werror=maybe-uninitialized]\n 1161 |         buf_len = buf_vec[vec_idx].buf_len;\n      |                   ~~~~~~~~~~~~~~~~^~~~~~~~\n\nGCC complains about the possible runtime path where the while loop\nwhich fills buf_vec (in vhost_enqueue_async_packed) is not run. As a\nconsequence it correctly thinks that buf_vec is not initialized while\nbeing accessed anyways.\n\nThis scenario is actually very unlikely as the only way this can occur\nis if size has overflowed to 0. Meaning that the total packet length\nwould be close to UINT64_MAX (or actually UINT32_MAX). At first glance,\nthe code suggests that this may never happen as the type of size has\nbeen changed to 64-bit. For a 32-bit architecture such as arm\n(e.g. armv7-a) and aarch32, this still happens because the operand types\n(pkt->pkt_len and sizeof) are 32-bit wide, performing 32-bit arithmetic\nfirst (where the overflow can happen) and widening to 64-bit later.\n\nThe proposed fix simply guarantees to the compiler that the scope which\nfills buf_vec is accessed at least once, while not disrupting the actual\nlogic. This is based on the assumption that size will always be greater\nthan 0, as suggested by the sizeof, and the packet length will never be\nas big as UINT32_MAX, and causing an overflow.\n\nFixes: 873e8dad6f49 (\"vhost: support packed ring in async datapath\")\nCc: stable@dpdk.org\n\nSigned-off-by: Luca Vizzarro <luca.vizzarro@arm.com>\nReviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>\nReviewed-by: Nick Connolly <nick.connolly@arm.com>\n---\n lib/vhost/virtio_net.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c\nindex 1359c5fb1f..6a2ca295f5 100644\n--- a/lib/vhost/virtio_net.c\n+++ b/lib/vhost/virtio_net.c\n@@ -1935,7 +1935,7 @@ vhost_enqueue_async_packed(struct virtio_net *dev,\n \telse\n \t\tmax_tries = 1;\n \n-\twhile (size > 0) {\n+\tdo {\n \t\t/*\n \t\t * if we tried all available ring items, and still\n \t\t * can't get enough buf, it means something abnormal\n@@ -1962,7 +1962,7 @@ vhost_enqueue_async_packed(struct virtio_net *dev,\n \t\tavail_idx += desc_count;\n \t\tif (avail_idx >= vq->size)\n \t\t\tavail_idx -= vq->size;\n-\t}\n+\t} while (size > 0);\n \n \tif (unlikely(mbuf_to_desc(dev, vq, pkt, buf_vec, nr_vec, *nr_buffers, true) < 0))\n \t\treturn -1;\n",
    "prefixes": [
        "1/1"
    ]
}