get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 556247,
    "url": "http://patchwork.ozlabs.org/api/patches/556247/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-mtd/patch/566DF656.2020509@simon.arlott.org.uk/",
    "project": {
        "id": 3,
        "url": "http://patchwork.ozlabs.org/api/projects/3/?format=api",
        "name": "Linux MTD development",
        "link_name": "linux-mtd",
        "list_id": "linux-mtd.lists.infradead.org",
        "list_email": "linux-mtd@lists.infradead.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<566DF656.2020509@simon.arlott.org.uk>",
    "list_archive_url": null,
    "date": "2015-12-13T22:51:02",
    "name": "[linux-next,v4,08/11] mtd: bcm63xxpart: Extract read of image tag to separate function",
    "commit_ref": "7fffa694a8917af0c553ab48290a57e3674aa5d3",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "d05296a31027add35ac250ba3d6fc85f35980975",
    "submitter": {
        "id": 1123,
        "url": "http://patchwork.ozlabs.org/api/people/1123/?format=api",
        "name": "Simon Arlott",
        "email": "simon@fire.lp0.eu"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-mtd/patch/566DF656.2020509@simon.arlott.org.uk/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/556247/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/556247/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Received": [
            "from bombadil.infradead.org (bombadil.infradead.org\n\t[IPv6:2001:1868:205::9])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id C8A73140311\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 14 Dec 2015 09:52:41 +1100 (AEDT)",
            "from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux))\n\tid 1a8FUI-0008BF-JA; Sun, 13 Dec 2015 22:51:30 +0000",
            "from proxima.lp0.eu ([2001:8b0:ffea:0:205:b4ff:fe12:530])\n\tby bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux))\n\tid 1a8FUE-00083f-KW\n\tfor linux-mtd@lists.infradead.org; Sun, 13 Dec 2015 22:51:27 +0000",
            "from redrum.lp0.eu ([2001:8b0:ffea:0:2e0:81ff:fe4d:2bec]:44503\n\tident=simon)\n\tby proxima.lp0.eu ([2001:8b0:ffea:0:205:b4ff:fe12:530]:465)\n\twith esmtpsav (UNKNOWN:DHE-RSA-AES256-SHA:256/CN=Simon Arlott)\n\tid 1a8FTr-00045N-OY (Exim); Sun, 13 Dec 2015 22:51:04 +0000"
        ],
        "Authentication-Results": "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tsecure) header.d=fire.lp0.eu header.i=@fire.lp0.eu header.b=cO2c2z4t;\n\tdkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=fire.lp0.eu; s=exim; \n\th=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:Cc:References:To:Subject;\n\tbh=HAsHjk8kwqVAxNMxmkJuebN7RC4GAhW2W+mamwPQW3A=; \n\tb=cO2c2z4t+ZcfCkCIDHtP0lediVR3BagcVMoC80cnM+liL5vr2koCXCkrMJ9T9h4blD4Z1dfrh2PR+tKgbIOTZsW7luSz+Rh6S49LtqEFfoJ9VS73g+9CttiKqFyZDqQ7Bw4Qf5BzjJk4pRiHw0aBrzq+v0qEsqzbyfoiQd1SUcBBYuGv0Q8H2oW30v0t5dy0PoiMPXPtTcJjrqZgf5cQfxmvBcYsG5uPJxSRhlh8JVlCzJ1ELahBx8wL72iYII9VXrHjXFMUQKbHYDN4qahrHxxx5irFt+67OuUIB4baTnIw9CdIhuJtmmUgYFz1Nz9aT1lDc7UW5gXoDwWUiT93tQ==;",
        "Subject": "[PATCH linux-next v4 08/11] mtd: bcm63xxpart: Extract read of image\n\ttag to separate function",
        "To": "Ralf Baechle <ralf@linux-mips.org>, David Woodhouse\n\t<dwmw2@infradead.org>, Brian Norris <computersforpeace@gmail.com>,\n\tKevin Cernekee <cernekee@gmail.com>, Florian Fainelli\n\t<f.fainelli@gmail.com>, Jonas Gorski <jogo@openwrt.org>",
        "References": "<566DF43B.5010400@simon.arlott.org.uk>",
        "From": "Simon Arlott <simon@fire.lp0.eu>",
        "Message-ID": "<566DF656.2020509@simon.arlott.org.uk>",
        "Date": "Sun, 13 Dec 2015 22:51:02 +0000",
        "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101\n\tThunderbird/38.4.0",
        "MIME-Version": "1.0",
        "In-Reply-To": "<566DF43B.5010400@simon.arlott.org.uk>",
        "X-CRM114-Version": "20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ",
        "X-CRM114-CacheID": "sfid-20151213_145127_011574_3A1E3312 ",
        "X-CRM114-Status": "GOOD (  14.99  )",
        "X-Spam-Score": "-4.3 (----)",
        "X-Spam-Report": "SpamAssassin version 3.4.0 on bombadil.infradead.org summary:\n\tContent analysis details:   (-4.3 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\n\tmedium trust [2001:8b0:ffea:0:205:b4ff:fe12:530 listed in]\n\t[list.dnswl.org]\n\t-0.0 SPF_HELO_PASS          SPF: HELO matches SPF record\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t-0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\n\tdomain\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n\tauthor's domain\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature",
        "X-BeenThere": "linux-mtd@lists.infradead.org",
        "X-Mailman-Version": "2.1.20",
        "Precedence": "list",
        "List-Id": "Linux MTD discussion mailing list <linux-mtd.lists.infradead.org>",
        "List-Unsubscribe": "<http://lists.infradead.org/mailman/options/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.infradead.org/pipermail/linux-mtd/>",
        "List-Post": "<mailto:linux-mtd@lists.infradead.org>",
        "List-Help": "<mailto:linux-mtd-request@lists.infradead.org?subject=help>",
        "List-Subscribe": "<http://lists.infradead.org/mailman/listinfo/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=subscribe>",
        "Cc": "MIPS Mailing List <linux-mips@linux-mips.org>,\n\tMTD Maling List <linux-mtd@lists.infradead.org>,\n\tLinux Kernel Mailing List <linux-kernel@vger.kernel.org>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "\"linux-mtd\" <linux-mtd-bounces@lists.infradead.org>",
        "Errors-To": "linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"
    },
    "content": "Extract image tag reading and CRC check to a separate function.\n\nSigned-off-by: Simon Arlott <simon@fire.lp0.eu>\n---\nv4: New patch.\n\n drivers/mtd/bcm63xxpart.c | 62 ++++++++++++++++++++++++++++++-----------------\n 1 file changed, 40 insertions(+), 22 deletions(-)",
    "diff": "diff --git a/drivers/mtd/bcm63xxpart.c b/drivers/mtd/bcm63xxpart.c\nindex 1eea8b6..eafbf52 100644\n--- a/drivers/mtd/bcm63xxpart.c\n+++ b/drivers/mtd/bcm63xxpart.c\n@@ -41,6 +41,10 @@\n #define BCM963XX_CFE_VERSION_OFFSET\t0x570\n #define BCM963XX_NVRAM_OFFSET\t\t0x580\n \n+/* Ensure strings read from flash structs are null terminated */\n+#define STR_NULL_TERMINATE(x) \\\n+\tdo { char *_str = (x); _str[sizeof(x) - 1] = 0; } while (0)\n+\n static int bcm63xx_detect_cfe(struct mtd_info *master)\n {\n \tchar buf[9];\n@@ -89,6 +93,37 @@ static int bcm63xx_read_nvram(struct mtd_info *master,\n \treturn 0;\n }\n \n+static int bcm63xx_read_image_tag(struct mtd_info *master, const char *name,\n+\tloff_t tag_offset, struct bcm_tag *buf)\n+{\n+\tint ret;\n+\tsize_t retlen;\n+\tu32 computed_crc;\n+\n+\tret = mtd_read(master, tag_offset, sizeof(*buf), &retlen, (void *)buf);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tif (retlen != sizeof(*buf))\n+\t\treturn -EIO;\n+\n+\tcomputed_crc = crc32_le(IMAGETAG_CRC_START, (u8 *)buf,\n+\t\t\t\toffsetof(struct bcm_tag, header_crc));\n+\tif (computed_crc == buf->header_crc) {\n+\t\tSTR_NULL_TERMINATE(buf->board_id);\n+\t\tSTR_NULL_TERMINATE(buf->tag_version);\n+\n+\t\tpr_info(\"%s: CFE image tag found at 0x%llx with version %s, board type %s\\n\",\n+\t\t\tname, tag_offset, buf->tag_version, buf->board_id);\n+\n+\t\treturn 0;\n+\t}\n+\n+\tpr_warn(\"%s: CFE image tag at 0x%llx CRC invalid (expected %08x, actual %08x)\\n\",\n+\t\tname, tag_offset, buf->header_crc, computed_crc);\n+\treturn 1;\n+}\n+\n static int bcm63xx_parse_cfe_partitions(struct mtd_info *master,\n \t\t\t\t\tconst struct mtd_partition **pparts,\n \t\t\t\t\tstruct mtd_part_parser_data *data)\n@@ -99,13 +134,11 @@ static int bcm63xx_parse_cfe_partitions(struct mtd_info *master,\n \tstruct bcm_tag *buf = NULL;\n \tstruct mtd_partition *parts;\n \tint ret;\n-\tsize_t retlen;\n \tunsigned int rootfsaddr, kerneladdr, spareaddr;\n \tunsigned int rootfslen, kernellen, sparelen, totallen;\n \tunsigned int cfelen, nvramlen;\n \tunsigned int cfe_erasesize;\n \tint i;\n-\tu32 computed_crc;\n \tbool rootfs_first = false;\n \n \tif (bcm63xx_detect_cfe(master))\n@@ -134,28 +167,13 @@ static int bcm63xx_parse_cfe_partitions(struct mtd_info *master,\n \t}\n \n \t/* Get the tag */\n-\tret = mtd_read(master, cfelen, sizeof(struct bcm_tag), &retlen,\n-\t\t       (void *)buf);\n-\n-\tif (retlen != sizeof(struct bcm_tag)) {\n-\t\tret = -EIO;\n-\t\tgoto out;\n-\t}\n-\n-\tcomputed_crc = crc32_le(IMAGETAG_CRC_START, (u8 *)buf,\n-\t\t\t\toffsetof(struct bcm_tag, header_crc));\n-\tif (computed_crc == buf->header_crc) {\n-\t\tchar *boardid = &(buf->board_id[0]);\n-\t\tchar *tagversion = &(buf->tag_version[0]);\n-\n+\tret = bcm63xx_read_image_tag(master, \"rootfs\", cfelen, buf);\n+\tif (!ret) {\n \t\tsscanf(buf->flash_image_start, \"%u\", &rootfsaddr);\n \t\tsscanf(buf->kernel_address, \"%u\", &kerneladdr);\n \t\tsscanf(buf->kernel_length, \"%u\", &kernellen);\n \t\tsscanf(buf->total_length, \"%u\", &totallen);\n \n-\t\tpr_info(\"CFE boot tag found with version %s and board type %s\\n\",\n-\t\t\ttagversion, boardid);\n-\n \t\tkerneladdr = kerneladdr - BCM963XX_EXTENDED_SIZE;\n \t\trootfsaddr = rootfsaddr - BCM963XX_EXTENDED_SIZE;\n \t\tspareaddr = roundup(totallen, master->erasesize) + cfelen;\n@@ -169,13 +187,13 @@ static int bcm63xx_parse_cfe_partitions(struct mtd_info *master,\n \t\t\trootfsaddr = kerneladdr + kernellen;\n \t\t\trootfslen = spareaddr - rootfsaddr;\n \t\t}\n-\t} else {\n-\t\tpr_warn(\"CFE boot tag CRC invalid (expected %08x, actual %08x)\\n\",\n-\t\t\tbuf->header_crc, computed_crc);\n+\t} else if (ret > 0) {\n \t\tkernellen = 0;\n \t\trootfslen = 0;\n \t\trootfsaddr = 0;\n \t\tspareaddr = cfelen;\n+\t} else {\n+\t\tgoto out;\n \t}\n \tsparelen = master->size - spareaddr - nvramlen;\n \n",
    "prefixes": [
        "linux-next",
        "v4",
        "08/11"
    ]
}