Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2217958/?format=api
{ "id": 2217958, "url": "http://patchwork.ozlabs.org/api/patches/2217958/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20260331032525.62304-1-S4210155@student.rmit.edu.au/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/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, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260331032525.62304-1-S4210155@student.rmit.edu.au>", "list_archive_url": null, "date": "2026-03-31T03:25:11", "name": "[v2] common: cli_hush: fix console_buffer overflow on boot retry", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "52bae548c17103cf0cf80f7ca3e62ee056d29b4a", "submitter": { "id": 92995, "url": "http://patchwork.ozlabs.org/api/people/92995/?format=api", "name": "Ngo Luong Thanh Tra", "email": "ngotra27101996@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20260331032525.62304-1-S4210155@student.rmit.edu.au/mbox/", "series": [ { "id": 498124, "url": "http://patchwork.ozlabs.org/api/series/498124/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=498124", "date": "2026-03-31T03:25:11", "name": "[v2] common: cli_hush: fix console_buffer overflow on boot retry", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/498124/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2217958/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2217958/checks/", "tags": {}, "related": [], "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=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=BiwDUHYO;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)", "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b=\"BiwDUHYO\";\n\tdkim-atps=neutral", "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=gmail.com", "phobos.denx.de;\n spf=pass smtp.mailfrom=ngotra27101996@gmail.com" ], "Received": [ "from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\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 4flHbF3j6Jz1y1q\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 31 Mar 2026 17:02:49 +1100 (AEDT)", "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 552E083DA7;\n\tTue, 31 Mar 2026 08:02:41 +0200 (CEST)", "by phobos.denx.de (Postfix, from userid 109)\n id 611A783DA7; Tue, 31 Mar 2026 05:25:39 +0200 (CEST)", "from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com\n [IPv6:2607:f8b0:4864:20::62e])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id A9DF480433\n for <u-boot@lists.denx.de>; Tue, 31 Mar 2026 05:25:36 +0200 (CEST)", "by mail-pl1-x62e.google.com with SMTP id\n d9443c01a7336-2b0afa0210bso26420925ad.2\n for <u-boot@lists.denx.de>; Mon, 30 Mar 2026 20:25:36 -0700 (PDT)", "from MacBookAir.STASGS.RMIT.EDU.VN ([103.253.89.37])\n by smtp.gmail.com with ESMTPSA id\n d9443c01a7336-2b24268aa4fsm93715645ad.36.2026.03.30.20.25.31\n (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);\n Mon, 30 Mar 2026 20:25:33 -0700 (PDT)" ], "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de", "X-Spam-Level": "", "X-Spam-Status": "No, score=-0.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_GMAIL_RCVD,\n FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED,\n SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1774927534; x=1775532334; darn=lists.denx.de;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=FCLFtUyqlK9HMbmyFRvcYFZGeZjuEwgIXOcldjl0dQE=;\n b=BiwDUHYO0TmzJWMyr1EFpuYUms0MPSzA8HmvSas41/bQdyneLi+zaCofoUBNWqtIQs\n SBm+2NxdtTe5ZMoV000a9WX+y2m04EUSTselz5dZOy7JyH4NHABTa6HcwKXZHbN4xKhM\n TUlmB3OKdPH6VEkmIT0Q8D3Ob4KKfp4fzFYvlnmccRSty5eNpZN4XUvMYqU9FPZG/jwm\n 4UkyY3HlBkfcsO7TR48fejHiw/+xpKG+UEvM+o+uwUgqxaIwgqQMI2EXCTU+sFGBMTeQ\n pIyNpNkDHEzmkTySwT0Tft+Ju3d3KwYZoSfZfNGlREyWasIqOJp7dKUtPx8ACbyc6U+1\n AIJQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774927534; x=1775532334;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=FCLFtUyqlK9HMbmyFRvcYFZGeZjuEwgIXOcldjl0dQE=;\n b=s39J0aFxpMklN4cD2i6LwPnXmw1Borjf8AgvBAn3lz70NqIlBzyCfKaPpcpdu5Bqyj\n ISn9+22EP21Kuyg4m+IzP0pWPzSmvhOL9PlCnxqz+KfZjl4EMhW/Ntwq7R8ZY5JyLb7e\n +JrvvQw7vacWlQl/Qq1TqUSYT8yEeJy9QyIqlf3lWlgDfqSi8SHTbUfePQF4pPz9L4gI\n vXCQFnGdETCm9wda28jowWH8Bz2nSv+hjt16LXPHV0vEtiXHxnLm8KBzGyaH3fzy+UMw\n 1t9Eo5yysUEWsy4+kBY3qfQ1xId1bBWvaqoIPovMQ2U0vUY4sAn4lOuO/KulNuvWrSZo\n rYIA==", "X-Gm-Message-State": "AOJu0YwRiD+FVze0RBPldu/cx9Gfoy4ji9/ShxMPOcAKv0BUMyEKqaE9\n tf1EsXqLanCF6aoPjHLspS/HtqGd33pbgbHHd3JvWIcZ+Tp36BqnU8ZFz7Exg6bs", "X-Gm-Gg": "ATEYQzwRVbJBCdOfiIlz2xX/akma2QLI2Udh56YS9Bg6vcSnA0xMAfpNEpVxjko1aqb\n hR+H87MxuTmzkp0sctbWEjFU0gcCwnufZlmGDZYQ/6q4S4Zqw8AFl7001PmOUCwRHN2g9D1MTHI\n t0ggQppAe9od7VTj+rMZZANAvsvfZFQaIMR9T0Grg6s3odqmCTA7YjoY45SDADswcViwrdR3MCn\n kycHAfKKz9orOqUJccykDwy/wyjiS/R0snpF+lvyMVsM5PcIhx9o0VwdWxKyVGhYKrJEIbf86Xg\n p7oY8fMfShQb8BQvC4bNwhi2A7S8MgeV1ZmFRVpFB3lYyIO2xuIAzX2x1rNFcXey3pJZdwYt4D2\n vXqP+SYcwke0RS7fbF+r0qdRkQ/84Qc20bHJTLj96OLmaey4WS12A6lQODMbRtCtMsZHWuv7G/6\n uJdBcxg1tD5KUg5bQMTQuNk6/NzzLvqDNNLjidoYVGWqfi55JC+Lm3Jf9NPT2ijI1aMmgYxuEsK\n w==", "X-Received": "by 2002:a17:902:e885:b0:2b0:663f:6b53 with SMTP id\n d9443c01a7336-2b0cdc9b555mr149940405ad.13.1774927534228;\n Mon, 30 Mar 2026 20:25:34 -0700 (PDT)", "From": "Ngo Luong Thanh Tra <ngotra27101996@gmail.com>", "X-Google-Original-From": "Ngo Luong Thanh Tra <S4210155@student.rmit.edu.au>", "To": "u-boot@lists.denx.de", "Cc": "Ngo Luong Thanh Tra <S4210155@student.rmit.edu.au>,\n Alexander Sverdlin <alexander.sverdlin@siemens.com>,\n Casey Connolly <casey.connolly@linaro.org>, Simon Glass <sjg@chromium.org>,\n Tom Rini <trini@konsulko.com>", "Subject": "[PATCH v2] common: cli_hush: fix console_buffer overflow on boot\n retry", "Date": "Tue, 31 Mar 2026 10:25:11 +0700", "Message-ID": "<20260331032525.62304-1-S4210155@student.rmit.edu.au>", "X-Mailer": "git-send-email 2.53.0", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-Mailman-Approved-At": "Tue, 31 Mar 2026 08:02:40 +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": "Add const_strcpy() macro to <linux/build_bug.h> that enforces at\ncompile time that the destination is a char array (not a pointer),\nthe source is a string literal, and the source fits in the\ndestination including the NUL terminator. It uses __builtin_strcpy()\nso the compiler can optimize the copy.\n\nFix the console_buffer extern declaration in <console.h> to include\nthe array size so that sizeof(console_buffer) is valid at call sites.\n\nReplace the unbounded strcpy() in cli_hush.c with const_strcpy() to\ncatch at compile time any configuration where CONFIG_SYS_CBSIZE is\nsmaller than the boot retry command string.\n\nFixes: 657e19f8f2dd (\"cli_hush: support running bootcmd on boot retry\")\nSigned-off-by: Ngo Luong Thanh Tra <S4210155@student.rmit.edu.au>\nTo: u-boot@lists.denx.de\n---\n\nChanges in v2:\n- Replace strlcpy() + BUILD_BUG_ON approach with a new const_strcpy()\n macro that enforces compile-time safety for string literal copies\n- Fix console_buffer extern declaration in <console.h> to include\n array size so sizeof(console_buffer) is valid at call sites\n- Address review from Rasmus Villemoes\n\n common/cli_hush.c | 3 ++-\n include/console.h | 3 ++-\n include/linux/build_bug.h | 23 +++++++++++++++++++++++\n 3 files changed, 27 insertions(+), 2 deletions(-)", "diff": "diff --git a/common/cli_hush.c b/common/cli_hush.c\nindex 7bd6943d3ed..048577cb40a 100644\n--- a/common/cli_hush.c\n+++ b/common/cli_hush.c\n@@ -84,6 +84,7 @@\n #include <cli_hush.h>\n #include <command.h> /* find_cmd */\n #include <asm/global_data.h>\n+#include <linux/build_bug.h>\n #endif\n #ifndef __U_BOOT__\n #include <ctype.h> /* isalpha, isdigit */\n@@ -1029,7 +1030,7 @@ static void get_user_input(struct in_str *i)\n # ifdef CONFIG_RESET_TO_RETRY\n \t do_reset(NULL, 0, 0, NULL);\n # elif IS_ENABLED(CONFIG_RETRY_BOOTCMD)\n-\tstrcpy(console_buffer, \"run bootcmd\\n\");\n+\tconst_strcpy(console_buffer, \"run bootcmd\\n\");\n # else\n #\terror \"This only works with CONFIG_RESET_TO_RETRY or CONFIG_BOOT_RETRY_COMMAND enabled\"\n # endif\ndiff --git a/include/console.h b/include/console.h\nindex 8d0d7bb8a4c..97ccf5e5f6a 100644\n--- a/include/console.h\n+++ b/include/console.h\n@@ -10,8 +10,9 @@\n #include <stdbool.h>\n #include <stdio_dev.h>\n #include <linux/errno.h>\n+#include <config.h>\n \n-extern char console_buffer[];\n+extern char console_buffer[CONFIG_SYS_CBSIZE + 1];\n \n /* common/console.c */\n int console_init_f(void);\t/* Before relocation; uses the serial stuff */\ndiff --git a/include/linux/build_bug.h b/include/linux/build_bug.h\nindex 20c2dc7f4bd..d775bf1bf91 100644\n--- a/include/linux/build_bug.h\n+++ b/include/linux/build_bug.h\n@@ -76,4 +76,27 @@\n #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)\n #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)\n \n+/**\n+ * const_strcpy - Copy a string literal to a char array with compile-time checks\n+ * @d: destination char array (must be a char array, not a pointer)\n+ * @s: source string literal\n+ *\n+ * Enforces at compile time that:\n+ * (a) @d is a char array, not a pointer\n+ * (b) @s is a string literal (adjacent string concatenation trick)\n+ * (c) @s fits in @d including the NUL terminator\n+ *\n+ * Uses __builtin_strcpy() so the compiler can optimize the copy into\n+ * immediate stores rather than emitting a function call.\n+ *\n+ * Note: @s is used twice in the macro expansion but this is intentional\n+ * and safe: the (\"\" s \"\") trick enforces at compile time that @s is a\n+ * string literal, and string literals have no side effects.\n+ */\n+#define const_strcpy(d, s) ({\t\t\t\t\t\t\\\n+\tBUILD_BUG_ON(__builtin_types_compatible_p(typeof(d), char *));\t\\\n+\tBUILD_BUG_ON(sizeof(d) < sizeof(\"\" s \"\"));\t\t\t\\\n+\t__builtin_strcpy(d, s);\t\t\t\t\t\t\\\n+})\n+\n #endif\t/* _LINUX_BUILD_BUG_H */\n", "prefixes": [ "v2" ] }