Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2190697/?format=api
{ "id": 2190697, "url": "http://patchwork.ozlabs.org/api/patches/2190697/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20260129223116.653124-1-marek.vasut+renesas@mailbox.org/", "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": "<20260129223116.653124-1-marek.vasut+renesas@mailbox.org>", "list_archive_url": null, "date": "2026-01-29T22:30:18", "name": "[1/2] net: Stop conflating return value with file size in net_loop()", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "43c54fdaed28dc156a074ba1a8935d96c76ac569", "submitter": { "id": 85650, "url": "http://patchwork.ozlabs.org/api/people/85650/?format=api", "name": "Marek Vasut", "email": "marek.vasut+renesas@mailbox.org" }, "delegate": { "id": 157425, "url": "http://patchwork.ozlabs.org/api/users/157425/?format=api", "username": "jforissier", "first_name": "Jerome", "last_name": "Forissier", "email": "jerome.forissier@linaro.org" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20260129223116.653124-1-marek.vasut+renesas@mailbox.org/mbox/", "series": [ { "id": 490309, "url": "http://patchwork.ozlabs.org/api/series/490309/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=490309", "date": "2026-01-29T22:30:18", "name": "[1/2] net: Stop conflating return value with file size in net_loop()", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/490309/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2190697/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2190697/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 secure) header.d=mailbox.org header.i=@mailbox.org header.a=rsa-sha256\n header.s=mail20150812 header.b=LsjWr2VA;\n\tdkim=pass (2048-bit key) header.d=mailbox.org header.i=@mailbox.org\n header.a=rsa-sha256 header.s=mail20150812 header.b=UZvhV9uI;\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=reject dis=none) header.from=mailbox.org", "phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de", "phobos.denx.de;\n\tdkim=pass (2048-bit key;\n secure) header.d=mailbox.org header.i=@mailbox.org header.b=\"LsjWr2VA\";\n\tdkim=pass (2048-bit key) header.d=mailbox.org header.i=@mailbox.org\n header.b=\"UZvhV9uI\";\n\tdkim-atps=neutral", "phobos.denx.de;\n dmarc=pass (p=reject dis=none) header.from=mailbox.org", "phobos.denx.de;\n spf=pass smtp.mailfrom=marek.vasut+renesas@mailbox.org" ], "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 4f2DQP3bFbz1xsw\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 30 Jan 2026 09:31:40 +1100 (AEDT)", "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 7DDF884106;\n\tThu, 29 Jan 2026 23:31:31 +0100 (CET)", "by phobos.denx.de (Postfix, from userid 109)\n id B4EF38410B; Thu, 29 Jan 2026 23:31:30 +0100 (CET)", "from mout-p-102.mailbox.org (mout-p-102.mailbox.org\n [IPv6:2001:67c:2050:0:465::102])\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 5E44C84101\n for <u-boot@lists.denx.de>; Thu, 29 Jan 2026 23:31:28 +0100 (CET)", "from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4f2DQ8150rz9vHR;\n Thu, 29 Jan 2026 23:31:28 +0100 (CET)" ], "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 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=mailbox.org;\n s=mail20150812; t=1769725888;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=ged+bq2TXxx4gGgkdJCE/aBQrUa6s1ey4OGMBnnJZLE=;\n b=LsjWr2VAgYRQa/2UegnjHJ0mmRCHyflnrlKV2jOv3GIlr/aCstROy8wK4iAeK4jsZxZDQA\n 9DJ6gSLpbSj2r12IfY7DG9v8wsZT2Svj8Bgz2qJu3+Kgid3tD9EgZheX2I2jSPTZ9V4J6x\n 2abu1cR/p9QGT5BwbOAtZ5zy07Jyhffe6KQzMNIF6/Ekt28sJgJbpgL4mSEMV4zzKOa22v\n K7yILR4kEsGF/pHxz2q+Q845e5kg50cLKz5W1lSeSZyABgcnhlIgff7wKPB5vtWZmy9PpG\n qs1ygneGY0vcEISMYzFaPbOX2EYOe8RMTkuPavRFvHNYtJyaO4n5Z/nLhwBazg==", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org;\n s=mail20150812; t=1769725886;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=ged+bq2TXxx4gGgkdJCE/aBQrUa6s1ey4OGMBnnJZLE=;\n b=UZvhV9uIA/cq8tcDoVsuWHp4cnH2OCYK6/OC+fqJhaSevLeuQSfCul/uPFYRpooA4xfH3F\n OgV5Tk91XsQ5cOh8l+3d0XESSTEpPtGiiPptw8gmAXYK2rak7RWjP89An4UFGmmm8CHhXj\n 5CYznKIiSTav/SKz1J08QzJMBhnO26ovpiDLz9+NrVDNiSpcgbBl4M+rABzVg1wn3Gw+an\n P7pmvNTESHRbydO71PVUow9IVJugU188VT/VKnKeud+Nrm2C1FEwc+2jy3j+IGakCmKP4C\n l+9Q8jzH6JEOL03I75I+Poq/AB5sF9ASAi0NYLFy4j/EAWouu0/6blDhzHmkiA==" ], "From": "Marek Vasut <marek.vasut+renesas@mailbox.org>", "To": "u-boot@lists.denx.de", "Cc": "Yuya Hamamachi <yuya.hamamachi.sx@renesas.com>,\n Marek Vasut <marek.vasut+renesas@mailbox.org>,\n =?utf-8?q?Alvin_=C5=A0ipraga?= <alvin@pqrs.dk>,\n Alexander Sverdlin <alexander.sverdlin@siemens.com>,\n Andre Przywara <andre.przywara@arm.com>,\n Andrew Goodbody <andrew.goodbody@linaro.org>,\n Ilias Apalodimas <ilias.apalodimas@linaro.org>,\n Jerome Forissier <jerome@forissier.org>,\n Joe Hershberger <joe.hershberger@ni.com>,\n Leonard Anderweit <l.anderweit@phytec.de>,\n Mattijs Korpershoek <mkorpershoek@kernel.org>,\n Quentin Schulz <quentin.schulz@cherry.de>,\n Ramon Fried <rfried.dev@gmail.com>, Simon Glass <sjg@chromium.org>,\n Tom Rini <trini@konsulko.com>", "Subject": "[PATCH 1/2] net: Stop conflating return value with file size in\n net_loop()", "Date": "Thu, 29 Jan 2026 23:30:18 +0100", "Message-ID": "<20260129223116.653124-1-marek.vasut+renesas@mailbox.org>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "X-MBO-RS-ID": "a4534b2d64f15bce094", "X-MBO-RS-META": "fe98i4ashhg8pemr7wqt5bybzot5rk4j", "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": "From: Yuya Hamamachi <yuya.hamamachi.sx@renesas.com>\n\nThe net_loop() currently conflates return value with file size\nat the end of successful transfer, in NETLOOP_SUCCESS state.\n\nThe return type of net_loop() is int, which makes this practice\nworkable for file sizes below 2 GiB, but anything above that will\nlead to overflow and bogus negative return value from net_loop().\n\nThe return file size is only used by a few sites in the code base,\nwhich can be easily fixed. Change the net_loop() return value to\nalways be only a return code, in case of error the returned value\nis the error code, in case of successful transfer the value is 0\nor 1 instead of 0 or net_boot_file_size . This surely always fits\ninto a signed integer.\n\nBy keeping the return code 0 or 1 in case of successful transfer,\nno conditionals which depended on the old behavior are broken, but\nall the sites had to be inspected and updated accordingly.\n\nFix the few sites which depend on the file size by making them\ndirectly use the net_boot_file_size variable value. This variable\nis accessible to all of those sites already, because they all\ninclude net-common.h .\n\nSigned-off-by: Yuya Hamamachi <yuya.hamamachi.sx@renesas.com>\nSigned-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>\n---\nCc: \"Alvin Šipraga\" <alvin@pqrs.dk>\nCc: Alexander Sverdlin <alexander.sverdlin@siemens.com>\nCc: Andre Przywara <andre.przywara@arm.com>\nCc: Andrew Goodbody <andrew.goodbody@linaro.org>\nCc: Ilias Apalodimas <ilias.apalodimas@linaro.org>\nCc: Jerome Forissier <jerome@forissier.org>\nCc: Joe Hershberger <joe.hershberger@ni.com>\nCc: Leonard Anderweit <l.anderweit@phytec.de>\nCc: Marek Vasut <marek.vasut+renesas@mailbox.org>\nCc: Mattijs Korpershoek <mkorpershoek@kernel.org>\nCc: Quentin Schulz <quentin.schulz@cherry.de>\nCc: Ramon Fried <rfried.dev@gmail.com>\nCc: Simon Glass <sjg@chromium.org>\nCc: Tom Rini <trini@konsulko.com>\nCc: Yuya Hamamachi <yuya.hamamachi.sx@renesas.com>\nCc: u-boot@lists.denx.de\n---\n cmd/mvebu/bubt.c | 2 +-\n cmd/net.c | 9 +++++----\n common/update.c | 10 +++++-----\n net/net.c | 2 +-\n 4 files changed, 12 insertions(+), 11 deletions(-)", "diff": "diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c\nindex 2755c26cdf7..f8e97d03920 100644\n--- a/cmd/mvebu/bubt.c\n+++ b/cmd/mvebu/bubt.c\n@@ -661,7 +661,7 @@ static size_t tftp_read_file(const char *file_name)\n \t */\n \timage_load_addr = get_load_addr();\n \tret = net_loop(TFTPGET);\n-\treturn ret > 0 ? ret : 0;\n+\treturn ret > 0 ? net_boot_file_size : 0;\n }\n \n static int is_tftp_active(void)\ndiff --git a/cmd/net.c b/cmd/net.c\nindex 24099764493..f6f556f36ae 100644\n--- a/cmd/net.c\n+++ b/cmd/net.c\n@@ -354,8 +354,8 @@ static int netboot_common(enum proto_t proto, struct cmd_tbl *cmdtp, int argc,\n \t\t\t char *const argv[])\n {\n \tchar *s;\n-\tint rcode = 0;\n-\tint size;\n+\tint rcode;\n+\tu32 size;\n \n \tnet_boot_file_name_explicit = false;\n \t*net_boot_file_name = '\\0';\n@@ -396,8 +396,9 @@ static int netboot_common(enum proto_t proto, struct cmd_tbl *cmdtp, int argc,\n \t\t}\n \t}\n \n-\tsize = net_loop(proto);\n-\tif (size < 0) {\n+\trcode = net_loop(proto);\n+\tsize = net_boot_file_size;\n+\tif (rcode < 0) {\n \t\tbootstage_error(BOOTSTAGE_ID_NET_NETLOOP_OK);\n \t\treturn CMD_RET_FAILURE;\n \t}\ndiff --git a/common/update.c b/common/update.c\nindex 6801b49479d..0bafffede9e 100644\n--- a/common/update.c\n+++ b/common/update.c\n@@ -32,7 +32,7 @@ static uchar *saved_prot_info;\n #endif\n static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)\n {\n-\tint size, rv;\n+\tint rv;\n \tulong saved_timeout_msecs;\n \tint saved_timeout_count;\n \tchar *saved_netretry, *saved_bootfile;\n@@ -54,12 +54,12 @@ static int update_load(char *filename, ulong msec_max, int cnt_max, ulong addr)\n \t/* download the update file */\n \timage_load_addr = addr;\n \tcopy_filename(net_boot_file_name, filename, sizeof(net_boot_file_name));\n-\tsize = net_loop(TFTPGET);\n+\trv = net_loop(TFTPGET);\n \n-\tif (size < 0)\n+\tif (rv < 0)\n \t\trv = 1;\n-\telse if (size > 0)\n-\t\tflush_cache(addr, size);\n+\telse\n+\t\tflush_cache(addr, net_boot_file_size);\n \n \t/* restore changed globals and env variable */\n \ttftp_timeout_ms = saved_timeout_msecs;\ndiff --git a/net/net.c b/net/net.c\nindex 8a8160e633f..ae3b977781f 100644\n--- a/net/net.c\n+++ b/net/net.c\n@@ -692,7 +692,7 @@ restart:\n \n \t\t\teth_set_last_protocol(protocol);\n \n-\t\t\tret = net_boot_file_size;\n+\t\t\tret = !!net_boot_file_size;\n \t\t\tdebug_cond(DEBUG_INT_STATE, \"--- net_loop Success!\\n\");\n \t\t\tgoto done;\n \n", "prefixes": [ "1/2" ] }