get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 812243,
    "url": "http://patchwork.ozlabs.org/api/patches/812243/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20170911074542.16777-3-nstange@suse.de/",
    "project": {
        "id": 28,
        "url": "http://patchwork.ozlabs.org/api/projects/28/?format=api",
        "name": "Linux PCI development",
        "link_name": "linux-pci",
        "list_id": "linux-pci.vger.kernel.org",
        "list_email": "linux-pci@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170911074542.16777-3-nstange@suse.de>",
    "list_archive_url": null,
    "date": "2017-09-11T07:45:41",
    "name": "[2/3] PCI: don't use snprintf() in driver_override_show()",
    "commit_ref": null,
    "pull_url": null,
    "state": "rejected",
    "archived": false,
    "hash": "f149a46e8403b72e054804e4d085cebd6180b22f",
    "submitter": {
        "id": 72345,
        "url": "http://patchwork.ozlabs.org/api/people/72345/?format=api",
        "name": "Nicolai Stange",
        "email": "nstange@suse.de"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20170911074542.16777-3-nstange@suse.de/mbox/",
    "series": [
        {
            "id": 2449,
            "url": "http://patchwork.ozlabs.org/api/series/2449/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=2449",
            "date": "2017-09-11T07:45:39",
            "name": "make PCI's and platform's driver_override_store()/show() converge",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/2449/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/812243/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/812243/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<linux-pci-owner@vger.kernel.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-pci-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)",
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xrKkb0XFCz9s81\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 11 Sep 2017 17:46:47 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1750944AbdIKHqc (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tMon, 11 Sep 2017 03:46:32 -0400",
            "from mx2.suse.de ([195.135.220.15]:47686 \"EHLO mx1.suse.de\"\n\trhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP\n\tid S1751071AbdIKHpu (ORCPT <rfc822;linux-pci@vger.kernel.org>);\n\tMon, 11 Sep 2017 03:45:50 -0400",
            "from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254])\n\tby mx1.suse.de (Postfix) with ESMTP id C3659ABDC;\n\tMon, 11 Sep 2017 07:45:48 +0000 (UTC)"
        ],
        "X-Virus-Scanned": "by amavisd-new at test-mx.suse.de",
        "From": "Nicolai Stange <nstange@suse.de>",
        "To": "Bjorn Helgaas <bhelgaas@google.com>,\n\tGreg Kroah-Hartman <gregkh@linuxfoundation.org>",
        "Cc": "Adrian Salido <salidoa@google.com>, Sasha Levin <sasha.levin@oracle.com>,\n\tlinux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,\n\tNicolai Stange <nstange@suse.de>",
        "Subject": "[PATCH 2/3] PCI: don't use snprintf() in driver_override_show()",
        "Date": "Mon, 11 Sep 2017 09:45:41 +0200",
        "Message-Id": "<20170911074542.16777-3-nstange@suse.de>",
        "X-Mailer": "git-send-email 2.13.5",
        "In-Reply-To": "<20170911074542.16777-1-nstange@suse.de>",
        "References": "<20170911074542.16777-1-nstange@suse.de>",
        "Sender": "linux-pci-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<linux-pci.vger.kernel.org>",
        "X-Mailing-List": "linux-pci@vger.kernel.org"
    },
    "content": "Quote from Documentation/filesystems/sysfs.txt:\n\n  show() must not use snprintf() when formatting the value to be\n  returned to user space. If you can guarantee that an overflow\n  will never happen you can use sprintf() otherwise you must use\n  scnprintf().\n\nCommit 4efe874aace5 (\"PCI: Don't read past the end of sysfs\n\"driver_override\" buffer\") introduced such a snprintf() usage from\ndriver_override_show() while at the same time tweaking\ndriver_override_store() such that the write buffer can't ever get\noverflowed.\n\nReasoning:\nSince aforementioned commit, driver_override_store() only accepts to be\nwritten buffers less than PAGE_SIZE - 1 in size.\n\nThe then kstrndup()'ed driver_override string will be at most PAGE_SIZE - 1\nin length, including the trailing '\\0'.\n\nAfter the addition of a '\\n' in driver_override_show(), the result won't\nexceed PAGE_SIZE characters in length, again including the trailing '\\0'.\n\nHence, snprintf(buf, PAGE_SIZE, ...) and sprintf(buf, ...) are equivalent\nat this point.\n\nReplace the former by the latter in order to adhere to the rules in\nDocumentation/filesystems/sysfs.txt.\n\nThis is a style fix only and there's no change in functionality.\n\nSigned-off-by: Nicolai Stange <nstange@suse.de>\n---\n drivers/pci/pci-sysfs.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)",
    "diff": "diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c\nindex 8e075ea2743e..43f7fbede448 100644\n--- a/drivers/pci/pci-sysfs.c\n+++ b/drivers/pci/pci-sysfs.c\n@@ -722,7 +722,7 @@ static ssize_t driver_override_show(struct device *dev,\n \tssize_t len;\n \n \tdevice_lock(dev);\n-\tlen = snprintf(buf, PAGE_SIZE, \"%s\\n\", pdev->driver_override);\n+\tlen = sprintf(buf, \"%s\\n\", pdev->driver_override);\n \tdevice_unlock(dev);\n \treturn len;\n }\n",
    "prefixes": [
        "2/3"
    ]
}