get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 13913,
    "url": "http://patches.dpdk.org/api/patches/13913/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1466090040-14865-1-git-send-email-marcinx.kerlin@intel.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": "<1466090040-14865-1-git-send-email-marcinx.kerlin@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1466090040-14865-1-git-send-email-marcinx.kerlin@intel.com",
    "date": "2016-06-16T15:14:00",
    "name": "[dpdk-dev,v5,1/1] eal: fix resource leak of mapped memory",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "a94f8fe5bb2dd3139052a2f0832c9162852fb10b",
    "submitter": {
        "id": 348,
        "url": "http://patches.dpdk.org/api/people/348/?format=api",
        "name": "Marcin Kerlin",
        "email": "marcinx.kerlin@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1466090040-14865-1-git-send-email-marcinx.kerlin@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/13913/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/13913/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id D3772C5A4;\n\tThu, 16 Jun 2016 16:01:26 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id 30807C468\n\tfor <dev@dpdk.org>; Thu, 16 Jun 2016 16:01:26 +0200 (CEST)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby fmsmga101.fm.intel.com with ESMTP; 16 Jun 2016 07:01:13 -0700",
            "from gklab-246-021.igk.intel.com (HELO HANLANCREEK9755-232)\n\t([10.217.246.21])\n\tby orsmga001.jf.intel.com with SMTP; 16 Jun 2016 07:01:03 -0700",
            "by HANLANCREEK9755-232 (sSMTP sendmail emulation);\n\tThu, 16 Jun 2016 17:14:11 +0200"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.26,480,1459839600\"; d=\"scan'208\";a=\"977049415\"",
        "From": "Marcin Kerlin <marcinx.kerlin@intel.com>",
        "To": "david.marchand@6wind.com",
        "Cc": "sergio.gonzalez.monroy@intel.com, dev@dpdk.org,\n\tMarcin Kerlin <marcinx.kerlin@intel.com>",
        "Date": "Thu, 16 Jun 2016 17:14:00 +0200",
        "Message-Id": "<1466090040-14865-1-git-send-email-marcinx.kerlin@intel.com>",
        "X-Mailer": "git-send-email 1.9.1",
        "In-Reply-To": "<1465993510-13448-1-git-send-email-marcinx.kerlin@intel.com>",
        "References": "<1465993510-13448-1-git-send-email-marcinx.kerlin@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v5 1/1] eal: fix resource leak of mapped memory",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Patch fixes resource leak in rte_eal_hugepage_attach() where mapped files\nwere not freed back to the OS in case of failure. Patch uses the behavior\nof Linux munmap: \"It is not an error if the indicated range does not\ncontain any mapped pages\".\n\nCoverity issue: 13295, 13296, 13303\nFixes: af75078fece3 (\"first public release\")\n\nSigned-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>\nAcked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>\n---\nv5:\n -shift the history of changes\nv4:\n -removed keyword const from pointer and dependent on that casting (void *)\nv3:\n -removed redundant casting\n -removed update error message\nv2:\n -unmapping also previous addresses\n\n lib/librte_eal/linuxapp/eal/eal_memory.c | 13 ++++++++++---\n 1 file changed, 10 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c\nindex 79d1d2d..c935765 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_memory.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c\n@@ -1399,7 +1399,7 @@ int\n rte_eal_hugepage_attach(void)\n {\n \tconst struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;\n-\tconst struct hugepage_file *hp = NULL;\n+\tstruct hugepage_file *hp = NULL;\n \tunsigned num_hp = 0;\n \tunsigned i, s = 0; /* s used to track the segment number */\n \toff_t size;\n@@ -1481,7 +1481,7 @@ rte_eal_hugepage_attach(void)\n \n \tsize = getFileSize(fd_hugepage);\n \thp = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd_hugepage, 0);\n-\tif (hp == NULL) {\n+\tif (hp == MAP_FAILED) {\n \t\tRTE_LOG(ERR, EAL, \"Could not mmap %s\\n\", eal_hugepage_info_path());\n \t\tgoto error;\n \t}\n@@ -1545,12 +1545,19 @@ rte_eal_hugepage_attach(void)\n \t\ts++;\n \t}\n \t/* unmap the hugepage config file, since we are done using it */\n-\tmunmap((void *)(uintptr_t)hp, size);\n+\tmunmap(hp, size);\n \tclose(fd_zero);\n \tclose(fd_hugepage);\n \treturn 0;\n \n error:\n+\ts = 0;\n+\twhile (s < RTE_MAX_MEMSEG && mcfg->memseg[s].len > 0) {\n+\t\tmunmap(mcfg->memseg[s].addr, mcfg->memseg[s].len);\n+\t\ts++;\n+\t}\n+\tif (hp != NULL && hp != MAP_FAILED)\n+\t\tmunmap(hp, size);\n \tif (fd_zero >= 0)\n \t\tclose(fd_zero);\n \tif (fd_hugepage >= 0)\n",
    "prefixes": [
        "dpdk-dev",
        "v5",
        "1/1"
    ]
}