Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2219697/?format=api
{ "id": 2219697, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2219697/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20260403-winbond-ma35d1-v1-1-e2b08c4c5e35@bootlin.com/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/1.1/projects/18/?format=api", "name": "U-Boot", "link_name": "uboot", "list_id": "u-boot.lists.denx.de", "list_email": "u-boot@lists.denx.de", "web_url": null, "scm_url": null, "webscm_url": null }, "msgid": "<20260403-winbond-ma35d1-v1-1-e2b08c4c5e35@bootlin.com>", "date": "2026-04-03T16:17:09", "name": "[1/3] cmd: mtd: Prevent out-of-bound check", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "b6272cf59b03934c95fe078efd36a8bd848ed473", "submitter": { "id": 73368, "url": "http://patchwork.ozlabs.org/api/1.1/people/73368/?format=api", "name": "Miquel Raynal", "email": "miquel.raynal@bootlin.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20260403-winbond-ma35d1-v1-1-e2b08c4c5e35@bootlin.com/mbox/", "series": [ { "id": 498672, "url": "http://patchwork.ozlabs.org/api/1.1/series/498672/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=498672", "date": "2026-04-03T16:17:08", "name": "mtd: spinand: winbond: Misc fixes", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/498672/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2219697/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2219697/checks/", "tags": {}, "headers": { "Return-Path": "<u-boot-bounces@lists.denx.de>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256\n header.s=dkim header.b=pgeitUCv;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=85.214.62.61; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)", "phobos.denx.de;\n dmarc=pass (p=reject dis=none) header.from=bootlin.com", "phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de", "phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=bootlin.com header.i=@bootlin.com header.b=\"pgeitUCv\";\n\tdkim-atps=neutral", "phobos.denx.de;\n dmarc=pass (p=reject dis=none) header.from=bootlin.com", "phobos.denx.de;\n spf=pass smtp.mailfrom=miquel.raynal@bootlin.com" ], "Received": [ "from phobos.denx.de (phobos.denx.de [85.214.62.61])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fnVJ21hhVz1xtJ\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 04 Apr 2026 07:12:18 +1100 (AEDT)", "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 5FB3784132;\n\tFri, 3 Apr 2026 22:11:59 +0200 (CEST)", "by phobos.denx.de (Postfix, from userid 109)\n id BF617840D8; Fri, 3 Apr 2026 18:17:34 +0200 (CEST)", "from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id DAA57840B0\n for <u-boot@lists.denx.de>; Fri, 3 Apr 2026 18:17:32 +0200 (CEST)", "from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233])\n by smtpout-02.galae.net (Postfix) with ESMTPS id 74E251A312D;\n Fri, 3 Apr 2026 16:17:32 +0000 (UTC)", "from mail.galae.net (mail.galae.net [212.83.136.155])\n by smtpout-01.galae.net (Postfix) with ESMTPS id 3AE01603C1;\n Fri, 3 Apr 2026 16:17:32 +0000 (UTC)", "from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon)\n with ESMTPSA id 447B210450102;\n Fri, 3 Apr 2026 18:17:29 +0200 (CEST)" ], "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de", "X-Spam-Level": "", "X-Spam-Status": "No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,\n RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED,\n SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim;\n t=1775233051; h=from:subject:date:message-id:to:cc:mime-version:content-type:\n content-transfer-encoding:in-reply-to:references;\n bh=QUO7RVFa2vwds+YZmlKBo/ky9tqOPNc3WvnjUUvspZY=;\n b=pgeitUCvtS5jLQKlOBpGmrW0N8HUkPFKWOMNmGdbt3TnawFnkbirkbcT8qBNMGCgJDVeET\n A248ePc/HGnNzNt9dUygFY3ypnoPvU8cd18tpB87zFGGV0WbEvkhC1h8pBzgAx+K/dVVfD\n IMZBbWutt1c96tJrYJa9gloy3/N4BwDpUJ8HBe4qreDU7CbkCiaP1/+dtKgoKj1FdGh1dl\n XKxRvmdGN6MHrDz0/t8fDckCczwhQAmUvxPNcx3YKwAVsv3UWE+/OT5MNR54HQlZLHpi+t\n J6h22R2gw6uJ3YKwRqchkSScQuqN+vXJXlqApotVZOex62sCpZT3SCxqu2KKyA==", "From": "Miquel Raynal <miquel.raynal@bootlin.com>", "Date": "Fri, 03 Apr 2026 18:17:09 +0200", "Subject": "[PATCH 1/3] cmd: mtd: Prevent out-of-bound check", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Message-Id": "<20260403-winbond-ma35d1-v1-1-e2b08c4c5e35@bootlin.com>", "References": "<20260403-winbond-ma35d1-v1-0-e2b08c4c5e35@bootlin.com>", "In-Reply-To": "<20260403-winbond-ma35d1-v1-0-e2b08c4c5e35@bootlin.com>", "To": "u-boot@lists.denx.de, Frieder Schrempf <frieder.schrempf@kontron.de>", "Cc": "Thomas Petazzoni <thomas.petazzoni@bootlin.com>,\n Tom Rini <trini@konsulko.com>,\n Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>,\n Michael Trimarchi <michael@amarulasolutions.com>,\n Andrew Goodbody <andrew.goodbody@linaro.org>,\n Quentin Schulz <quentin.schulz@cherry.de>,\n Dario Binacchi <dario.binacchi@amarulasolutions.com>,\n Christian Marangi <ansuelsmth@gmail.com>, Steam Lin <stlin2@winbond.com>,\n Miquel Raynal <miquel.raynal@bootlin.com>", "X-Mailer": "b4 0.14.3", "X-Last-TLS-Session-Version": "TLSv1.3", "X-Mailman-Approved-At": "Fri, 03 Apr 2026 22:11:58 +0200", "X-BeenThere": "u-boot@lists.denx.de", "X-Mailman-Version": "2.1.39", "Precedence": "list", "List-Id": "U-Boot discussion <u-boot.lists.denx.de>", "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>", "List-Archive": "<https://lists.denx.de/pipermail/u-boot/>", "List-Post": "<mailto:u-boot@lists.denx.de>", "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>", "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>", "Errors-To": "u-boot-bounces@lists.denx.de", "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>", "X-Virus-Scanned": "clamav-milter 0.103.8 at phobos.denx.de", "X-Virus-Status": "Clean" }, "content": "The while() loops searching for the next \"good\" block is unbounded,\nwhich means in some cases when looking close to the end of the\ndevice (or during development purposes) this check may lead to\nunexpected behaviours.\n\nFor instance, I observed the SPI NAND core complaining because there was\na single \"target\" (as in \"die\"), but the core was selecting the second\none, which is simply impossible as it does not exist.\n\nSigned-off-by: Miquel Raynal <miquel.raynal@bootlin.com>\n---\n cmd/mtd.c | 12 +++++++++++-\n 1 file changed, 11 insertions(+), 1 deletion(-)", "diff": "diff --git a/cmd/mtd.c b/cmd/mtd.c\nindex 7f25144098bb..d3289ab5edbf 100644\n--- a/cmd/mtd.c\n+++ b/cmd/mtd.c\n@@ -559,8 +559,13 @@ static int do_mtd_io(struct cmd_tbl *cmdtp, int flag, int argc,\n \n \t/* Search for the first good block after the given offset */\n \toff = start_off;\n-\twhile (mtd_block_isbad(mtd, off))\n+\twhile (mtd_block_isbad(mtd, off)) {\n \t\toff += mtd->erasesize;\n+\t\tif (off >= mtd->size) {\n+\t\t\tret = CMD_RET_FAILURE;\n+\t\t\tgoto out_put_mtd;\n+\t\t}\n+\t}\n \n \tled_activity_blink();\n \n@@ -573,6 +578,11 @@ static int do_mtd_io(struct cmd_tbl *cmdtp, int flag, int argc,\n \t\tif (mtd_is_aligned_with_block_size(mtd, off) &&\n \t\t mtd_block_isbad(mtd, off)) {\n \t\t\toff += mtd->erasesize;\n+\t\t\tif (off >= mtd->size) {\n+\t\t\t\tret = CMD_RET_FAILURE;\n+\t\t\t\tgoto out_put_mtd;\n+\t\t\t}\n+\n \t\t\tcontinue;\n \t\t}\n \n", "prefixes": [ "1/3" ] }