get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 35277,
    "url": "http://patches.dpdk.org/api/patches/35277/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1519112078-20113-44-git-send-email-arybchenko@solarflare.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": "<1519112078-20113-44-git-send-email-arybchenko@solarflare.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1519112078-20113-44-git-send-email-arybchenko@solarflare.com",
    "date": "2018-02-20T07:34:01",
    "name": "[dpdk-dev,43/80] net/sfc/base: resolve code analysis warnings",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "2fa5b28e71bce50d040643b65fe8a55317e59cf6",
    "submitter": {
        "id": 607,
        "url": "http://patches.dpdk.org/api/people/607/?format=api",
        "name": "Andrew Rybchenko",
        "email": "arybchenko@solarflare.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1519112078-20113-44-git-send-email-arybchenko@solarflare.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/35277/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/35277/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 2B9A81B3F0;\n\tTue, 20 Feb 2018 08:36:10 +0100 (CET)",
            "from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com\n\t[67.231.154.164]) by dpdk.org (Postfix) with ESMTP id 58C291B1B3\n\tfor <dev@dpdk.org>; Tue, 20 Feb 2018 08:35:39 +0100 (CET)",
            "from webmail.solarflare.com (webmail.solarflare.com\n\t[12.187.104.26])\n\t(using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1-us1.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with\n\tESMTPS id\n\t5ACAEB00056 for <dev@dpdk.org>; Tue, 20 Feb 2018 07:35:38 +0000 (UTC)",
            "from sfocexch01r.SolarFlarecom.com (10.20.40.34) by\n\tocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server\n\t(TLS) id 15.0.1044.25; Mon, 19 Feb 2018 23:35:35 -0800",
            "from ocex03.SolarFlarecom.com (10.20.40.36) by\n\tsfocexch01r.SolarFlarecom.com (10.20.40.34) with Microsoft SMTP\n\tServer (TLS) id 15.0.1044.25; Mon, 19 Feb 2018 23:35:15 -0800",
            "from opal.uk.solarflarecom.com (10.17.10.1) by\n\tocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server\n\t(TLS) id\n\t15.0.1044.25 via Frontend Transport; Mon, 19 Feb 2018 23:35:14 -0800",
            "from uklogin.uk.solarflarecom.com (uklogin.uk.solarflarecom.com\n\t[10.17.10.10])\n\tby opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id\n\tw1K7ZDmp025114; Tue, 20 Feb 2018 07:35:13 GMT",
            "from uklogin.uk.solarflarecom.com (localhost.localdomain\n\t[127.0.0.1])\n\tby uklogin.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id\n\tw1K7ZBtt020529; Tue, 20 Feb 2018 07:35:13 GMT"
        ],
        "X-Virus-Scanned": "Proofpoint Essentials engine",
        "From": "Andrew Rybchenko <arybchenko@solarflare.com>",
        "To": "<dev@dpdk.org>",
        "CC": "Richard Houldsworth <rhouldsworth@solarflare.com>",
        "Date": "Tue, 20 Feb 2018 07:34:01 +0000",
        "Message-ID": "<1519112078-20113-44-git-send-email-arybchenko@solarflare.com>",
        "X-Mailer": "git-send-email 1.8.2.3",
        "In-Reply-To": "<1519112078-20113-1-git-send-email-arybchenko@solarflare.com>",
        "References": "<1519112078-20113-1-git-send-email-arybchenko@solarflare.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-MDID": "1519112139-ABj7ICizUiq5",
        "Subject": "[dpdk-dev] [PATCH 43/80] net/sfc/base: resolve code analysis\n\twarnings",
        "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://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": "<https://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": "From: Richard Houldsworth <rhouldsworth@solarflare.com>\n\nMinimal changes adding buffer size checks and simplifying checksum\nprocessing.\n\nSigned-off-by: Richard Houldsworth <rhouldsworth@solarflare.com>\nSigned-off-by: Andrew Rybchenko <arybchenko@solarflare.com>\n---\n drivers/net/sfc/base/efx_bootcfg.c | 67 +++++++++++++++++++++++++++-----------\n 1 file changed, 48 insertions(+), 19 deletions(-)",
    "diff": "diff --git a/drivers/net/sfc/base/efx_bootcfg.c b/drivers/net/sfc/base/efx_bootcfg.c\nindex 3a29306..715e18e 100644\n--- a/drivers/net/sfc/base/efx_bootcfg.c\n+++ b/drivers/net/sfc/base/efx_bootcfg.c\n@@ -209,19 +209,25 @@ efx_bootcfg_copy_sector(\n \tsize_t used_bytes;\n \tefx_rc_t rc;\n \n+\t/* Minimum buffer is checksum byte and DHCP_END terminator */\n+\tif (data_size < 2) {\n+\t\trc = ENOSPC;\n+\t\tgoto fail1;\n+\t}\n+\n \t/* Verify that the area is correctly formatted and checksummed */\n \trc = efx_bootcfg_verify(enp, sector, sector_length,\n \t\t\t\t    &used_bytes);\n \n \tif (!handle_format_errors) {\n \t\tif (rc != 0)\n-\t\t\tgoto fail1;\n+\t\t\tgoto fail2;\n \n \t\tif ((used_bytes < 2) ||\n \t\t    (sector[used_bytes - 1] != DHCP_END)) {\n \t\t\t/* Block too short, or DHCP_END missing */\n \t\t\trc = ENOENT;\n-\t\t\tgoto fail2;\n+\t\t\tgoto fail3;\n \t\t}\n \t}\n \n@@ -255,9 +261,13 @@ efx_bootcfg_copy_sector(\n \t */\n \tif (used_bytes > data_size) {\n \t\trc = ENOSPC;\n-\t\tgoto fail3;\n+\t\tgoto fail4;\n \t}\n-\tmemcpy(data, sector, used_bytes);\n+\n+\tdata[0] = 0; /* checksum, updated below */\n+\n+\t/* Copy all after the checksum to the target buffer */\n+\tmemcpy(data + 1, sector + 1, used_bytes - 1);\n \n \t/* Zero out the unused portion of the target buffer */\n \tif (used_bytes < data_size)\n@@ -271,6 +281,8 @@ efx_bootcfg_copy_sector(\n \n \treturn (0);\n \n+fail4:\n+\tEFSYS_PROBE(fail4);\n fail3:\n \tEFSYS_PROBE(fail3);\n fail2:\n@@ -295,6 +307,12 @@ efx_bootcfg_read(\n \tefx_rc_t rc;\n \tuint32_t sector_number;\n \n+\t/* Minimum buffer is checksum byte and DHCP_END terminator */\n+\tif (size < 2) {\n+\t\trc = ENOSPC;\n+\t\tgoto fail1;\n+\t}\n+\n #if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2\n \tsector_number = enp->en_nic_cfg.enc_pf;\n #else\n@@ -302,13 +320,18 @@ efx_bootcfg_read(\n #endif\n \trc = efx_nvram_size(enp, EFX_NVRAM_BOOTROM_CFG, &partn_length);\n \tif (rc != 0)\n-\t\tgoto fail1;\n+\t\tgoto fail2;\n \n \t/* The bootcfg sector may be stored in a (larger) shared partition */\n \trc = efx_bootcfg_sector_info(enp, sector_number,\n \t    NULL, &sector_offset, &sector_length);\n \tif (rc != 0)\n-\t\tgoto fail2;\n+\t\tgoto fail3;\n+\n+\tif (sector_length < 2) {\n+\t\trc = EINVAL;\n+\t\tgoto fail4;\n+\t}\n \n \tif (sector_length > BOOTCFG_MAX_SIZE)\n \t\tsector_length = BOOTCFG_MAX_SIZE;\n@@ -316,7 +339,7 @@ efx_bootcfg_read(\n \tif (sector_offset + sector_length > partn_length) {\n \t\t/* Partition is too small */\n \t\trc = EFBIG;\n-\t\tgoto fail3;\n+\t\tgoto fail5;\n \t}\n \n \t/*\n@@ -329,28 +352,28 @@ efx_bootcfg_read(\n \t\tEFSYS_KMEM_ALLOC(enp->en_esip, sector_length, payload);\n \t\tif (payload == NULL) {\n \t\t\trc = ENOMEM;\n-\t\t\tgoto fail4;\n+\t\t\tgoto fail6;\n \t\t}\n \t} else\n \t\tpayload = (uint8_t *)data;\n \n \tif ((rc = efx_nvram_rw_start(enp, EFX_NVRAM_BOOTROM_CFG, NULL)) != 0)\n-\t\tgoto fail5;\n+\t\tgoto fail7;\n \n \tif ((rc = efx_nvram_read_chunk(enp, EFX_NVRAM_BOOTROM_CFG,\n \t    sector_offset, (caddr_t)payload, sector_length)) != 0) {\n \t\t(void) efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG, NULL);\n-\t\tgoto fail6;\n+\t\tgoto fail8;\n \t}\n \n \tif ((rc = efx_nvram_rw_finish(enp, EFX_NVRAM_BOOTROM_CFG, NULL)) != 0)\n-\t\tgoto fail7;\n+\t\tgoto fail9;\n \n \t/* Verify that the area is correctly formatted and checksummed */\n \trc = efx_bootcfg_verify(enp, payload, sector_length,\n \t    &used_bytes);\n \tif (rc != 0 || used_bytes == 0) {\n-\t\tpayload[0] = (uint8_t)(~DHCP_END & 0xff);\n+\t\tpayload[0] = 0;\n \t\tpayload[1] = DHCP_END;\n \t\tused_bytes = 2;\n \t}\n@@ -365,10 +388,8 @@ efx_bootcfg_read(\n \t * so reinitialise the sector if there isn't room for the character.\n \t */\n \tif (payload[used_bytes - 1] != DHCP_END) {\n-\t\tif (used_bytes + 1 > sector_length) {\n-\t\t\tpayload[0] = 0;\n+\t\tif (used_bytes >= sector_length)\n \t\t\tused_bytes = 1;\n-\t\t}\n \n \t\tpayload[used_bytes] = DHCP_END;\n \t\t++used_bytes;\n@@ -380,10 +401,14 @@ efx_bootcfg_read(\n \t */\n \tif (used_bytes > size) {\n \t\trc = ENOSPC;\n-\t\tgoto fail8;\n+\t\tgoto fail10;\n \t}\n+\n+\tdata[0] = 0; /* checksum, updated below */\n+\n \tif (sector_length > size) {\n-\t\tmemcpy(data, payload, used_bytes);\n+\t\t/* Copy all after the checksum to the target buffer */\n+\t\tmemcpy(data + 1, payload + 1, used_bytes - 1);\n \t\tEFSYS_KMEM_FREE(enp->en_esip, sector_length, payload);\n \t}\n \n@@ -399,16 +424,20 @@ efx_bootcfg_read(\n \n \treturn (0);\n \n+fail10:\n+\tEFSYS_PROBE(fail10);\n+fail9:\n+\tEFSYS_PROBE(fail9);\n fail8:\n \tEFSYS_PROBE(fail8);\n fail7:\n \tEFSYS_PROBE(fail7);\n+\tif (sector_length > size)\n+\t\tEFSYS_KMEM_FREE(enp->en_esip, sector_length, payload);\n fail6:\n \tEFSYS_PROBE(fail6);\n fail5:\n \tEFSYS_PROBE(fail5);\n-\tif (sector_length > size)\n-\t\tEFSYS_KMEM_FREE(enp->en_esip, sector_length, payload);\n fail4:\n \tEFSYS_PROBE(fail4);\n fail3:\n",
    "prefixes": [
        "dpdk-dev",
        "43/80"
    ]
}