Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2234880/?format=api
{ "id": 2234880, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2234880/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260508082128.3344255-2-kanie@linux.alibaba.com/", "project": { "id": 28, "url": "http://patchwork.ozlabs.org/api/1.2/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": "<20260508082128.3344255-2-kanie@linux.alibaba.com>", "list_archive_url": null, "date": "2026-05-08T08:21:27", "name": "[v12,1/2] PCI: Introduce named defines for PCI ROM", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "c026c41f603c22fc47653902664e72e25cc0a691", "submitter": { "id": 89531, "url": "http://patchwork.ozlabs.org/api/1.2/people/89531/?format=api", "name": "Guixin Liu", "email": "kanie@linux.alibaba.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260508082128.3344255-2-kanie@linux.alibaba.com/mbox/", "series": [ { "id": 503346, "url": "http://patchwork.ozlabs.org/api/1.2/series/503346/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=503346", "date": "2026-05-08T08:21:26", "name": "PCI: Fix crash when access broken ROM", "version": 12, "mbox": "http://patchwork.ozlabs.org/series/503346/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2234880/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2234880/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-pci+bounces-54239-incoming=patchwork.ozlabs.org@vger.kernel.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-pci@vger.kernel.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=linux.alibaba.com header.i=@linux.alibaba.com\n header.a=rsa-sha256 header.s=default header.b=EbXaJVOr;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c15:e001:75::12fc:5321; helo=sin.lore.kernel.org;\n envelope-from=linux-pci+bounces-54239-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=linux.alibaba.com\n header.i=@linux.alibaba.com header.b=\"EbXaJVOr\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=115.124.30.124", "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.alibaba.com", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=linux.alibaba.com" ], "Received": [ "from sin.lore.kernel.org (sin.lore.kernel.org\n [IPv6:2600:3c15:e001:75::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4gBhtz35N6z1yKm\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 08 May 2026 18:22:35 +1000 (AEST)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sin.lore.kernel.org (Postfix) with ESMTP id 4823E300BE94\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 8 May 2026 08:21:54 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 77FB636167E;\n\tFri, 8 May 2026 08:21:51 +0000 (UTC)", "from out30-124.freemail.mail.aliyun.com\n (out30-124.freemail.mail.aliyun.com [115.124.30.124])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 6575B376467\n\tfor <linux-pci@vger.kernel.org>; Fri, 8 May 2026 08:21:43 +0000 (UTC)", "from localhost(mailfrom:kanie@linux.alibaba.com\n fp:SMTPD_---0X2WlMZ8_1778228494 cluster:ay36)\n by smtp.aliyun-inc.com;\n Fri, 08 May 2026 16:21:39 +0800" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1778228510; cv=none;\n b=sIc8RsOvzJPzMJ7pkxOIAa0sRnGcTqJom/msqbd8keyzAjPHdDm09/78tfsqyvOvhvWESIhsPvw45w7ZyNN7tuklvn+rINI55uKmSbv2Vu0JqmKiEtRM8T/YEK1NHM3m16CkCLuF5NItkVtSHyQlREqLabDp+bgSOy7zYauIqsc=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1778228510; c=relaxed/simple;\n\tbh=zxqBjMhSSVpB89dg/Rjmf328WU9161TGP2hwu6q5bLc=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version:Content-Type;\n b=ismRiK8jqdju/v/175pjCQoJZYBqRmy31sRncfHbWRS66esJHpcvNnQC/vgSgvjl0QJnIt2YXjdikScp1TFGM6H2vXM8KXsyWyWpSdjeZl40SCgz8zLHWnLkMU/cgXrLN/q1TM0CTfrZRqbFSkjGWtgf032CZGfDpvobAS57Pa8=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.alibaba.com;\n spf=pass smtp.mailfrom=linux.alibaba.com;\n dkim=pass (1024-bit key) header.d=linux.alibaba.com\n header.i=@linux.alibaba.com header.b=EbXaJVOr;\n arc=none smtp.client-ip=115.124.30.124", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=linux.alibaba.com; s=default;\n\tt=1778228500; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type;\n\tbh=hO2PElEIjMvpVRGSGcJtlqbivWyXHypCmbZD2jxc3YE=;\n\tb=EbXaJVOrCpjqs0X9CuHUGNrKt2hkl5z4kf7a1zWnTnkxpWYYvlBIX+jCzpzLaC0M+RppS8nWjb7PMiQMXDwz9N7wD8W3H1JNU6CWa0r0sDZtJhkQy1oNqqWukNYbsx+3NMMU7J6DwCe84EZ6Vxy5CoqOw51cYH0w1aVU6bcqD1U=", "X-Alimail-AntiSpam": "\n AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037009110;MF=kanie@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0X2WlMZ8_1778228494;", "From": "Guixin Liu <kanie@linux.alibaba.com>", "To": "Bjorn Helgaas <bhelgaas@google.com>,\n Andy Shevchenko <andriy.shevchenko@intel.com>,\n =?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>, =?utf-8?q?K?=\n\t=?utf-8?q?rzysztof_Wilczy=C5=84ski?= <kwilczynski@kernel.org>", "Cc": "linux-pci@vger.kernel.org,\n\txlpang@linux.alibaba.com,\n\toliver.yang@linux.alibaba.com", "Subject": "[PATCH v12 1/2] PCI: Introduce named defines for PCI ROM", "Date": "Fri, 8 May 2026 16:21:27 +0800", "Message-ID": "<20260508082128.3344255-2-kanie@linux.alibaba.com>", "X-Mailer": "git-send-email 2.43.7", "In-Reply-To": "<20260508082128.3344255-1-kanie@linux.alibaba.com>", "References": "<20260508082128.3344255-1-kanie@linux.alibaba.com>", "Precedence": "bulk", "X-Mailing-List": "linux-pci@vger.kernel.org", "List-Id": "<linux-pci.vger.kernel.org>", "List-Subscribe": "<mailto:linux-pci+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-pci+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit" }, "content": "Convert the magic numbers associated with PCI ROM into named\ndefinitions. Some of these definitions will be used in the second\nfix patch.\n\nSigned-off-by: Guixin Liu <kanie@linux.alibaba.com>\nReviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>\nReviewed-by: Krzysztof Wilczyński <kwilczynski@kernel.org>\n---\n drivers/pci/rom.c | 40 ++++++++++++++++++++++++++++------------\n 1 file changed, 28 insertions(+), 12 deletions(-)", "diff": "diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c\nindex e18d3a4383ba..d4a141bd148b 100644\n--- a/drivers/pci/rom.c\n+++ b/drivers/pci/rom.c\n@@ -5,13 +5,28 @@\n * (C) Copyright 2004 Jon Smirl <jonsmirl@yahoo.com>\n * (C) Copyright 2004 Silicon Graphics, Inc. Jesse Barnes <jbarnes@sgi.com>\n */\n+\n+#include <linux/bits.h>\n #include <linux/kernel.h>\n #include <linux/export.h>\n #include <linux/pci.h>\n+#include <linux/sizes.h>\n #include <linux/slab.h>\n \n #include \"pci.h\"\n \n+#define PCI_ROM_HEADER_SIZE\t\t\t0x1A\n+#define PCI_ROM_POINTER_TO_DATA_STRUCT\t\t0x18\n+#define PCI_ROM_LAST_IMAGE_INDICATOR\t\t0x15\n+#define PCI_ROM_LAST_IMAGE_INDICATOR_BIT\tBIT(7)\n+#define PCI_ROM_IMAGE_LEN\t\t\t0x10\n+#define PCI_ROM_IMAGE_SECTOR_SIZE\t\tSZ_512\n+#define PCI_ROM_IMAGE_SIGNATURE\t\t\t0xAA55\n+\n+/* Data structure signature is \"PCIR\" in ASCII representation */\n+#define PCI_ROM_DATA_STRUCT_SIGNATURE\t\t0x52494350\n+#define PCI_ROM_DATA_STRUCT_LEN\t\t\t0x0A\n+\n /**\n * pci_enable_rom - enable ROM decoding for a PCI device\n * @pdev: PCI device to enable\n@@ -91,26 +106,27 @@ static size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom,\n \tdo {\n \t\tvoid __iomem *pds;\n \t\t/* Standard PCI ROMs start out with these bytes 55 AA */\n-\t\tif (readw(image) != 0xAA55) {\n-\t\t\tpci_info(pdev, \"Invalid PCI ROM header signature: expecting 0xaa55, got %#06x\\n\",\n-\t\t\t\t readw(image));\n+\t\tif (readw(image) != PCI_ROM_IMAGE_SIGNATURE) {\n+\t\t\tpci_info(pdev, \"Invalid PCI ROM header signature: expecting %#06x, got %#06x\\n\",\n+\t\t\t\t PCI_ROM_IMAGE_SIGNATURE, readw(image));\n \t\t\tbreak;\n \t\t}\n-\t\t/* get the PCI data structure and check its \"PCIR\" signature */\n-\t\tpds = image + readw(image + 24);\n-\t\tif (readl(pds) != 0x52494350) {\n-\t\t\tpci_info(pdev, \"Invalid PCI ROM data signature: expecting 0x52494350, got %#010x\\n\",\n-\t\t\t\t readl(pds));\n+\t\t/* Get the PCI data structure and check its \"PCIR\" signature */\n+\t\tpds = image + readw(image + PCI_ROM_POINTER_TO_DATA_STRUCT);\n+\t\tif (readl(pds) != PCI_ROM_DATA_STRUCT_SIGNATURE) {\n+\t\t\tpci_info(pdev, \"Invalid PCI ROM data signature: expecting %#010x, got %#010x\\n\",\n+\t\t\t\t PCI_ROM_DATA_STRUCT_SIGNATURE, readl(pds));\n \t\t\tbreak;\n \t\t}\n-\t\tlast_image = readb(pds + 21) & 0x80;\n-\t\tlength = readw(pds + 16);\n-\t\timage += length * 512;\n+\t\tlast_image = readb(pds + PCI_ROM_LAST_IMAGE_INDICATOR) &\n+\t\t\t\t PCI_ROM_LAST_IMAGE_INDICATOR_BIT;\n+\t\tlength = readw(pds + PCI_ROM_IMAGE_LEN);\n+\t\timage += length * PCI_ROM_IMAGE_SECTOR_SIZE;\n \t\t/* Avoid iterating through memory outside the resource window */\n \t\tif (image >= rom + size)\n \t\t\tbreak;\n \t\tif (!last_image) {\n-\t\t\tif (readw(image) != 0xAA55) {\n+\t\t\tif (readw(image) != PCI_ROM_IMAGE_SIGNATURE) {\n \t\t\t\tpci_info(pdev, \"No more image in the PCI ROM\\n\");\n \t\t\t\tbreak;\n \t\t\t}\n", "prefixes": [ "v12", "1/2" ] }