From patchwork Sat Apr 2 09:46:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1612498 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=OuCE+mrR; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KVsfH4TWgz9sFr for ; Sat, 2 Apr 2022 20:47:51 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A743D83931; Sat, 2 Apr 2022 11:47:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.b="OuCE+mrR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 67A1483938; Sat, 2 Apr 2022 11:47:24 +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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6EE12838BA for ; Sat, 2 Apr 2022 11:47:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from LT2ubnt.fritz.box (ip-088-152-144-107.um26.pools.vodafone-ip.de [88.152.144.107]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id BA7873F1AC; Sat, 2 Apr 2022 09:47:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1648892839; bh=W8ga41wm/7rC5TnPYO8LH+EiewRo35ZEo2/tGEkugjs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OuCE+mrRDrQFCneCVEk7p/efwyaCR0ecczXRjtnVC/XPKl1gYt1uHtb5gzOgwtPso djDthR/ZbnOcTO62yoPu1iWB0je85pooytWYZGbYa9p9DV5aUOX+tKBoI2B/1t35xD N9zQcpD1dYE/RnLkUijhxvkyI6iKYa1jkqZRjbRh4ZOJCFRzVZgNrw5cYr6e0PgMQp geibn0ekryPSlb//kLXPABrKky7xt6M/i7XZbGD8TLMJzq9GKE5LDqnOVb7m1Nx5mu EBVcgyX28CMkMAyndMLilKaikuARgyq7MQpJ18zbAeUofKTayf1j89cPR0hk2YF8k4 VkOUK+9ylk59g== From: Heinrich Schuchardt To: u-boot@lists.denx.de Cc: Heinrich Schuchardt Subject: [PATCH 1/4] lib: convert u16_strlen() into a macro Date: Sat, 2 Apr 2022 11:46:58 +0200 Message-Id: <20220402094701.51825-2-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220402094701.51825-1-heinrich.schuchardt@canonical.com> References: <20220402094701.51825-1-heinrich.schuchardt@canonical.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean The function u16_strlen() can be implemented as call to u16_strnlen(). Signed-off-by: Heinrich Schuchardt --- include/charset.h | 26 ++++++++++++++------------ lib/charset.c | 12 ------------ 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/include/charset.h b/include/charset.h index b93d023092..38908e08f0 100644 --- a/include/charset.h +++ b/include/charset.h @@ -200,18 +200,6 @@ int u16_strncmp(const u16 *s1, const u16 *s2, size_t n); */ #define u16_strcmp(s1, s2) u16_strncmp((s1), (s2), SIZE_MAX) -/** - * u16_strlen - count non-zero words - * - * This function matches wsclen() if the -fshort-wchar compiler flag is set. - * In the EFI context we explicitly need a function handling u16 strings. - * - * @in: null terminated u16 string - * Return: number of non-zero words. - * This is not the number of utf-16 letters! - */ -size_t u16_strlen(const void *in); - /** * u16_strsize() - count size of u16 string in bytes including the null * character @@ -236,6 +224,20 @@ size_t u16_strsize(const void *in); */ size_t u16_strnlen(const u16 *in, size_t count); +/** + * u16_strlen - count non-zero words + * + * This function matches wsclen() if the -fshort-wchar compiler flag is set. + * In the EFI context we explicitly need a function handling u16 strings. + * + * @in: null terminated u16 string + * Return: number of non-zero words. + * This is not the number of utf-16 letters! + */ +size_t u16_strlen(const void *in); + +#define u16_strlen(in) u16_strnlen(in, SIZE_MAX) + /** * u16_strcpy() - copy u16 string * diff --git a/lib/charset.c b/lib/charset.c index f44c58d9d8..91cbe87509 100644 --- a/lib/charset.c +++ b/lib/charset.c @@ -375,18 +375,6 @@ int u16_strncmp(const u16 *s1, const u16 *s2, size_t n) return ret; } -size_t u16_strlen(const void *in) -{ - const char *pos = in; - size_t ret; - - for (; pos[0] || pos[1]; pos += 2) - ; - ret = pos - (char *)in; - ret >>= 1; - return ret; -} - size_t __efi_runtime u16_strnlen(const u16 *in, size_t count) { size_t i; From patchwork Sat Apr 2 09:46:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1612500 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=FofcQELv; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KVsfq1RC0z9sFr for ; Sat, 2 Apr 2022 20:48:18 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5D0A483972; Sat, 2 Apr 2022 11:47:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.b="FofcQELv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7DA52838BA; Sat, 2 Apr 2022 11:47:30 +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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D4CC78390C for ; Sat, 2 Apr 2022 11:47:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from LT2ubnt.fritz.box (ip-088-152-144-107.um26.pools.vodafone-ip.de [88.152.144.107]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 4B3F33F7F8; Sat, 2 Apr 2022 09:47:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1648892840; bh=WBecMezVMnVaMRGj/2PcHqXYB9Uri2/o84OcnibzdQg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FofcQELv/g3n4n7UU4JhlX8Wy0MAAXNNbooamhWHapC0XsX/5CBCerPgwVFP9oZWn nz/N6hBKepUOdLs/a3XpYTq0sk8BrIriSf7f9u4+Weqn1ob2LObYPdwy66BgGXT5zI ORQBuHSFpvGcGXHfZDRRsDpnqz5GYrDi/vbY+H7ISFxJsPsi9dC5vAmJo55EFceejO C6Xk9D2mkKhw8zeZfGett3RIpYkJEvyaJNinDIQtJ9o7eVF8KvNvdmB8KlUfOkCFwG Yo6Y82LOF6jqS04MjGyUyI5tti8Iu/FXS2nz83wmrh0haZsjP6Wx0oQcwoTPnhrh2h 3yT6Oelxd3r3w== From: Heinrich Schuchardt To: u-boot@lists.denx.de Cc: Heinrich Schuchardt Subject: [PATCH 2/4] lib: simplify u16_strdup() Date: Sat, 2 Apr 2022 11:46:59 +0200 Message-Id: <20220402094701.51825-3-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220402094701.51825-1-heinrich.schuchardt@canonical.com> References: <20220402094701.51825-1-heinrich.schuchardt@canonical.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Use u16_strsize() instead of duplicating it. Signed-off-by: Heinrich Schuchardt --- lib/charset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/charset.c b/lib/charset.c index 91cbe87509..de201cf3b9 100644 --- a/lib/charset.c +++ b/lib/charset.c @@ -407,7 +407,7 @@ u16 *u16_strdup(const void *src) if (!src) return NULL; - len = (u16_strlen(src) + 1) * sizeof(u16); + len = u16_strsize(src); new = malloc(len); if (!new) return NULL; From patchwork Sat Apr 2 09:47:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1612501 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=ovN7SW4c; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KVsgd74XZz9sFr for ; Sat, 2 Apr 2022 20:49:01 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3AA0283988; Sat, 2 Apr 2022 11:47:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.b="ovN7SW4c"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 98B67838D5; Sat, 2 Apr 2022 11:47:30 +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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4636D8392B for ; Sat, 2 Apr 2022 11:47:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from LT2ubnt.fritz.box (ip-088-152-144-107.um26.pools.vodafone-ip.de [88.152.144.107]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id BE46C3F1AC; Sat, 2 Apr 2022 09:47:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1648892840; bh=ncLAzmX6wF6M8OpZj65QF9cEODSFDiahW7fWg43IdU8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ovN7SW4ccFJAtBMzKEGdcey6nohr5UOpgzt5DryNjHnTbHEEOJ9B7achttjAt3rMh hlqni4lwDG5aZPQyr/NtYT2H7jOOM35NmYG6WsQB8Uufo+cOIXAXYv8rhTzO72C8Uo S9jOSWRVPhT032jcHcO2Hd1VswM1PMvTElCyRX7ZgapGai0dUArUoveYpeZrkr/4te 2BsHcgKtnbFaBapxsFk0/zquKvwIws96V+49TSjqK94CIqhxSsXy+FmQHu90HCoIeu TmDPZO4ZDjoiLR5luPqCbR2cZF4hYW6NWFzNbZYUcAPW9j1WNGl1uleuw10Upn5lJ2 suPGJGPQjFiyQ== From: Heinrich Schuchardt To: u-boot@lists.denx.de Cc: Heinrich Schuchardt Subject: [PATCH 3/4] efi_loader: EFI_HII_STRING_PROTOCOL.GetString() Date: Sat, 2 Apr 2022 11:47:00 +0200 Message-Id: <20220402094701.51825-4-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220402094701.51825-1-heinrich.schuchardt@canonical.com> References: <20220402094701.51825-1-heinrich.schuchardt@canonical.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Use u16_strsize(). Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_hii.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_hii.c b/lib/efi_loader/efi_hii.c index 9f87e95e32..75ff58aafa 100644 --- a/lib/efi_loader/efi_hii.c +++ b/lib/efi_loader/efi_hii.c @@ -900,7 +900,7 @@ get_string(const struct efi_hii_string_protocol *this, str = stbl->strings[string_id - 1].string; if (str) { - len = (u16_strlen(str) + 1) * sizeof(u16); + len = u16_strsize(str); if (*string_size < len) { *string_size = len; From patchwork Sat Apr 2 09:47:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1612499 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=WyRxdpmY; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KVsff3RXYz9sFr for ; Sat, 2 Apr 2022 20:48:10 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A95678394E; Sat, 2 Apr 2022 11:47:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.b="WyRxdpmY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AB8E7838BA; Sat, 2 Apr 2022 11:47: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, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A36D283931 for ; Sat, 2 Apr 2022 11:47:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from LT2ubnt.fritz.box (ip-088-152-144-107.um26.pools.vodafone-ip.de [88.152.144.107]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 2F4A93F7F8; Sat, 2 Apr 2022 09:47:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1648892841; bh=wkgqs5imIb9MSv8RJBMLqwKuQc/HuN4mexIZPc0RMQo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WyRxdpmYkHwU7HUGxXAHbKPpBSSJEaz5s4wXRVoPN/dClBUCNaBFNQ6uSXm+3tTXP i/dB7LVOa6Yg5cM0Xy4zSu1uHdxoD8pH9ZgeEJ1xQx7f7GfVwkPDcEA+kI/hUOKvkR 0HHuqMamLYzba99pqNHbW03YalkpGeaP0ZjytFWaNYu+iRP9i4DPzH+1T0ZlFVcxvT yW3JFhc1YKnAeufzuNl3j+7Aqqv5Dc9BOFnvNTdmIuNWmjI+RtQLVrJz0iItMqK/qc lZlGyk2cgs7NRK52g9j/r51Ut6ooaY+G74fsDs0CkL1b15GOi6k8iyBccRZiKxiWAC daySUBjb3c4EQ== From: Heinrich Schuchardt To: u-boot@lists.denx.de Cc: Heinrich Schuchardt Subject: [PATCH 4/4] efi_loader: simplify efi_serialize_load_option() Date: Sat, 2 Apr 2022 11:47:01 +0200 Message-Id: <20220402094701.51825-5-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220402094701.51825-1-heinrich.schuchardt@canonical.com> References: <20220402094701.51825-1-heinrich.schuchardt@canonical.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Use u16_strsize(). Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_load_options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_load_options.c b/lib/efi_loader/efi_load_options.c index 68cd85ba2e..71454f0fc6 100644 --- a/lib/efi_loader/efi_load_options.c +++ b/lib/efi_loader/efi_load_options.c @@ -113,7 +113,7 @@ unsigned long efi_serialize_load_option(struct efi_load_option *lo, u8 **data) unsigned long size; u8 *p; - label_len = (u16_strlen(lo->label) + 1) * sizeof(u16); + label_len = u16_strsize(lo->label); /* total size */ size = sizeof(lo->attributes);