get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 131163,
    "url": "http://patchwork.dpdk.org/api/patches/131163/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20230904142432.21372-1-artur.paszkiewicz@intel.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": "<20230904142432.21372-1-artur.paszkiewicz@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230904142432.21372-1-artur.paszkiewicz@intel.com",
    "date": "2023-09-04T14:24:32",
    "name": "malloc: fix allocation for a specific case with ASAN",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "44b968d849a8892c37d995af8105320be2a4317b",
    "submitter": {
        "id": 3175,
        "url": "http://patchwork.dpdk.org/api/people/3175/?format=api",
        "name": "Artur Paszkiewicz",
        "email": "artur.paszkiewicz@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20230904142432.21372-1-artur.paszkiewicz@intel.com/mbox/",
    "series": [
        {
            "id": 29423,
            "url": "http://patchwork.dpdk.org/api/series/29423/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=29423",
            "date": "2023-09-04T14:24:32",
            "name": "malloc: fix allocation for a specific case with ASAN",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/29423/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/131163/comments/",
    "check": "warning",
    "checks": "http://patchwork.dpdk.org/api/patches/131163/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 3CC15424F1;\n\tMon,  4 Sep 2023 16:39:02 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 1A933402E9;\n\tMon,  4 Sep 2023 16:39:02 +0200 (CEST)",
            "from mgamail.intel.com (mgamail.intel.com [134.134.136.65])\n by mails.dpdk.org (Postfix) with ESMTP id 5694F402C1\n for <dev@dpdk.org>; Mon,  4 Sep 2023 16:24:53 +0200 (CEST)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 04 Sep 2023 07:24:52 -0700",
            "from apaszkie-mobl2.apaszkie-mobl2 (HELO apaszkie-mobl2.intel.com)\n ([10.213.27.32])\n by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 04 Sep 2023 07:24:51 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1693837493; x=1725373493;\n h=from:to:cc:subject:date:message-id:mime-version:\n content-transfer-encoding;\n bh=MC++iX0hPj//3ultKplXFewO8NFRVi9+eCpFj1gHzN4=;\n b=Y2h5y81yXs1UScMosZCikOOKm7XIv5oQF4vfKPMvjfa7OPwb8d00pf1D\n 4+sGyL6oau3s7a8qmKwsII1FusxwbfFbzcTx7U79bJjFtknzv6Zx+CJzl\n zTeACLJtnSTeJ1IJG51HZnbjGHtUD2JHtgOO520qhVMCMaVOutkXVnOun\n +nLELcRnPqN5rUMWvJnMet3g50t40RitbuSMcC6VpOGu53NFj65cmi1c9\n aqNVkCWzmlGeJDZtOi89MgjusfYqXJ17trKrGCR+tCBreybgq9oKTjWJa\n 9poXLw/vFhgRV4fOnvcbaPKLbDSMp41oGVP7geBG3wCgDMSls1GmD9/Rx g==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6600,9927,10823\"; a=\"380402997\"",
            "E=Sophos;i=\"6.02,226,1688454000\"; d=\"scan'208\";a=\"380402997\"",
            "E=McAfee;i=\"6600,9927,10823\"; a=\"806276124\"",
            "E=Sophos;i=\"6.02,226,1688454000\"; d=\"scan'208\";a=\"806276124\""
        ],
        "X-ExtLoop1": "1",
        "From": "Artur Paszkiewicz <artur.paszkiewicz@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "anatoly.burakov@intel.com, Artur Paszkiewicz <artur.paszkiewicz@intel.com>",
        "Subject": "[PATCH] malloc: fix allocation for a specific case with ASAN",
        "Date": "Mon,  4 Sep 2023 16:24:32 +0200",
        "Message-Id": "<20230904142432.21372-1-artur.paszkiewicz@intel.com>",
        "X-Mailer": "git-send-email 2.35.3",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-Mailman-Approved-At": "Mon, 04 Sep 2023 16:39:01 +0200",
        "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": "Allocation would fail with ASAN enabled if the size and alignment was\nequal to half of the page size, e.g.:\n\nsize_t pg_sz = 2 * (1 << 20);\nrte_malloc(NULL, pg_sz / 2, pg_sz / 2);\n\nIn such case, try_expand_heap_primary() only allocated one page but it\nis not enough to fit this allocation with such alignment and\nMALLOC_ELEM_TRAILER_LEN > 0, as correcly checked by\nmalloc_elem_can_hold().\n\nSigned-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>\n---\n lib/eal/common/malloc_heap.c | 4 ++--\n lib/eal/common/malloc_mp.c   | 4 ++--\n 2 files changed, 4 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/lib/eal/common/malloc_heap.c b/lib/eal/common/malloc_heap.c\nindex 6b6cf9174c..bb7da0d2ef 100644\n--- a/lib/eal/common/malloc_heap.c\n+++ b/lib/eal/common/malloc_heap.c\n@@ -402,8 +402,8 @@ try_expand_heap_primary(struct malloc_heap *heap, uint64_t pg_sz,\n \tint n_segs;\n \tbool callback_triggered = false;\n \n-\talloc_sz = RTE_ALIGN_CEIL(RTE_ALIGN_CEIL(elt_size, align) +\n-\t\t\tMALLOC_ELEM_OVERHEAD, pg_sz);\n+\talloc_sz = RTE_ALIGN_CEIL(RTE_MAX(MALLOC_ELEM_HEADER_LEN, align) +\n+\t\t\telt_size + MALLOC_ELEM_TRAILER_LEN, pg_sz);\n \tn_segs = alloc_sz / pg_sz;\n \n \t/* we can't know in advance how many pages we'll need, so we malloc */\ndiff --git a/lib/eal/common/malloc_mp.c b/lib/eal/common/malloc_mp.c\nindex 7270c2ec90..62deaca9eb 100644\n--- a/lib/eal/common/malloc_mp.c\n+++ b/lib/eal/common/malloc_mp.c\n@@ -250,8 +250,8 @@ handle_alloc_request(const struct malloc_mp_req *m,\n \t\treturn -1;\n \t}\n \n-\talloc_sz = RTE_ALIGN_CEIL(RTE_ALIGN_CEIL(ar->elt_size, ar->align) +\n-\t\t\tMALLOC_ELEM_OVERHEAD, ar->page_sz);\n+\talloc_sz = RTE_ALIGN_CEIL(RTE_MAX(MALLOC_ELEM_HEADER_LEN, ar->align) +\n+\t\t\tar->elt_size + MALLOC_ELEM_TRAILER_LEN, ar->page_sz);\n \tn_segs = alloc_sz / ar->page_sz;\n \n \t/* we can't know in advance how many pages we'll need, so we malloc */\n",
    "prefixes": []
}