{"id":2198285,"url":"http://patchwork.ozlabs.org/api/1.0/patches/2198285/?format=json","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.0/projects/18/?format=json","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":"<20260219184400.257008-5-vincent.stehle@arm.com>","date":"2026-02-19T18:43:59","name":"[4/5] efi_selftest: fix buffer size and count computations","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"f657c4d05bcd1d735734b4edece19dd319fa4d64","submitter":{"id":77169,"url":"http://patchwork.ozlabs.org/api/1.0/people/77169/?format=json","name":"Vincent Stehlé","email":"vincent.stehle@arm.com"},"delegate":{"id":68728,"url":"http://patchwork.ozlabs.org/api/1.0/users/68728/?format=json","username":"xypron","first_name":"Heinrich","last_name":"Schuchardt","email":"xypron.glpk@gmx.de"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20260219184400.257008-5-vincent.stehle@arm.com/mbox/","series":[{"id":492712,"url":"http://patchwork.ozlabs.org/api/1.0/series/492712/?format=json","date":"2026-02-19T18:43:55","name":"efi_selftest: manageprotocols fixes and enhancements","version":1,"mbox":"http://patchwork.ozlabs.org/series/492712/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2198285/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 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=fail (p=none dis=none) header.from=arm.com","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n dmarc=fail (p=none dis=none) header.from=arm.com","phobos.denx.de;\n spf=pass smtp.mailfrom=vincent.stehle@arm.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)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fH2P92gDYz1xpY\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 20 Feb 2026 05:45:01 +1100 (AEDT)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 6FAB083D77;\n\tThu, 19 Feb 2026 19:44:56 +0100 (CET)","by phobos.denx.de (Postfix, from userid 109)\n id 2746083D77; Thu, 19 Feb 2026 19:44:55 +0100 (CET)","from foss.arm.com (foss.arm.com [217.140.110.172])\n by phobos.denx.de (Postfix) with ESMTP id E4F2183CEE\n for <u-boot@lists.denx.de>; Thu, 19 Feb 2026 19:44:52 +0100 (CET)","from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])\n by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D9D72339;\n Thu, 19 Feb 2026 10:44:45 -0800 (PST)","from debian (unknown [10.57.12.78])\n by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E78773F62B;\n Thu, 19 Feb 2026 10:44:50 -0800 (PST)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-1.9 required=5.0 tests=BAYES_00,\n RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,\n RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_PASS,SPF_PASS autolearn=ham\n autolearn_force=no version=3.4.2","From":"=?utf-8?q?Vincent_Stehl=C3=A9?= <vincent.stehle@arm.com>","To":"u-boot@lists.denx.de","Cc":"=?utf-8?q?Vincent_Stehl=C3=A9?= <vincent.stehle@arm.com>,\n Heinrich Schuchardt <xypron.glpk@gmx.de>,\n Ilias Apalodimas <ilias.apalodimas@linaro.org>, Tom Rini <trini@konsulko.com>","Subject":"[PATCH 4/5] efi_selftest: fix buffer size and count computations","Date":"Thu, 19 Feb 2026 19:43:59 +0100","Message-ID":"<20260219184400.257008-5-vincent.stehle@arm.com>","X-Mailer":"git-send-email 2.51.0","In-Reply-To":"<20260219184400.257008-1-vincent.stehle@arm.com>","References":"<20260219184400.257008-1-vincent.stehle@arm.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","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":"When testing the UEFI LocateHandle() function, the BufferSize argument is\nerroneously computed with a count from three test steps before, leading to\nan incorrect input buffer size.\n\nAlso, while the buffer size returned by LocateHandle() is correctly\nconverted to a count during a subsequent comparison, it is incorrectly\npassed \"as is\" as a count to later calls to find_in_buffer().\n\nFinally, the variables usage during this test step is misleading, as the\n`buffer_size' variable is used to hold a count, and the `count' variable is\nused to hold a buffer size.\n\nFix all those issues at once, and remove also one copy to buffer_size,\nwhich has now become unnecessary.\n\nSigned-off-by: Vincent Stehlé <vincent.stehle@arm.com>\nCc: Heinrich Schuchardt <xypron.glpk@gmx.de>\nCc: Ilias Apalodimas <ilias.apalodimas@linaro.org>\nCc: Tom Rini <trini@konsulko.com>\n---\n lib/efi_selftest/efi_selftest_manageprotocols.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)","diff":"diff --git a/lib/efi_selftest/efi_selftest_manageprotocols.c b/lib/efi_selftest/efi_selftest_manageprotocols.c\nindex 7fe7b285011..f07ff256ce1 100644\n--- a/lib/efi_selftest/efi_selftest_manageprotocols.c\n+++ b/lib/efi_selftest/efi_selftest_manageprotocols.c\n@@ -170,7 +170,6 @@ static int execute(void)\n \t\tefi_st_error(\"LocateHandleBuffer with AllHandles failed\\n\");\n \t\treturn EFI_ST_FAILURE;\n \t}\n-\tbuffer_size = count;\n \tret = find_in_buffer(handle1, count, buffer);\n \tif (ret != EFI_SUCCESS) {\n \t\tefi_st_error(\"LocateHandleBuffer failed to locate new handle\\n\");\n@@ -245,14 +244,15 @@ static int execute(void)\n \t/*\n \t * Test LocateHandle with ByProtocol\n \t */\n-\tcount = buffer_size * sizeof(efi_handle_t);\n+\tbuffer_size = count * sizeof(efi_handle_t);\n \tret = boottime->locate_handle(BY_PROTOCOL, &guid1, NULL,\n-\t\t\t\t      &count, buffer);\n+\t\t\t\t      &buffer_size, buffer);\n \tif (ret != EFI_SUCCESS) {\n \t\tefi_st_error(\"LocateHandle with ByProtocol failed\\n\");\n \t\treturn EFI_ST_FAILURE;\n \t}\n-\tif (count / sizeof(efi_handle_t) != 2) {\n+\tcount = buffer_size / sizeof(efi_handle_t);\n+\tif (count != 2) {\n \t\tefi_st_error(\"LocateHandle failed to locate new handles\\n\");\n \t\treturn EFI_ST_FAILURE;\n \t}\n","prefixes":["4/5"]}