From patchwork Fri Dec 2 04:59:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 630192 Delivered-To: patch@linaro.org Received: by 2002:a17:906:9c8c:b0:7c0:a5ce:226a with SMTP id fj12csp903363ejc; Thu, 1 Dec 2022 21:00:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf4YlgkT+6mp9POugidMOnL3EWMq1h3Zn3fF2lg1GmV9cJgu4sE7tMP8W5lcF4yyWr5LNIy3 X-Received: by 2002:a05:6638:ca4:b0:389:dbc8:c058 with SMTP id x4-20020a0566380ca400b00389dbc8c058mr12207612jad.10.1669957235233; Thu, 01 Dec 2022 21:00:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669957235; cv=none; d=google.com; s=arc-20160816; b=tGfn7DaronFgTSLfUioIlri1oT6g6lJ6ZLAc5yQmCCRagx9UdEr/wGtAj/OkM7A4c0 18AbZKCc9FqE8xhwtuy+r0ebx3r6by/65RdOsXhJI2V+GAb6tFBvQcUMWqZFKe6Pxkou 8nkrCwX7OP1rGZmE9uryYdZnnwEgDNw7MYzM7zgueOFLNlch5mHXRdvwLquUcCHeOUJ4 nvhJAhyda/Gg8/Zp/RxBrjSs8P6tj3r+VyyizrrY4sRP+Iehefk1+6b9nDr4pQgSsHFP M2L7q0ceVWYgpMY/bJMOHRfBEgSk5KM+edUFb9ZJyoGWWFfptUmMAqug4ziZIF+nLGu8 oYaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=S5v+DipCYjKetPPz6/+HLl16R221oH+bNOTlG6ddslo=; b=HD3IS2DeCYqPt59Dm53KCZ/IMro0O2tbqN3aSvKU2w9TOTkXyuqMjaB5h1aP7D/7Rp SFolpH9Hm6ITmiFRcVbEV0MckkbmGl2F7v1Oe1sm/IosJeqvgFzyK+5oy5DqmqJw9nFh 5TgY5dXt1SqG1DDXoIG4Mo1bt8vYGbnlOeU6LgHHqBWOCyOtnECOXbfuBVSg17UwuexV 5NylLqbssdf3oofbCdnUhSwsHrWQYinu5I8E3ZE0G8TtOihR+XCu29RZ+QRe18Kl0Wbv hfwA0JA/1Ljuhu3DjnHB6BYxBudARm/tGV23VuKNwGY1jcIhUyNsi69B/eMxDPHIl3lC KNuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UzdSQiik; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id m21-20020a026d15000000b00375dad8d905si4742434jac.21.2022.12.01.21.00.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Dec 2022 21:00:35 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UzdSQiik; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E427F8545A; Fri, 2 Dec 2022 06:00:19 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="UzdSQiik"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9D1478544E; Fri, 2 Dec 2022 05:59:59 +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, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2B1FB85445 for ; Fri, 2 Dec 2022 05:59:55 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=masahisa.kojima@linaro.org Received: by mail-pj1-x1035.google.com with SMTP id l22-20020a17090a3f1600b00212fbbcfb78so7250023pjc.3 for ; Thu, 01 Dec 2022 20:59:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=S5v+DipCYjKetPPz6/+HLl16R221oH+bNOTlG6ddslo=; b=UzdSQiikB7cmX0ZahKkhYONOZ7LlSCyTXkxuCRL0w7cj+z+lbijUKfL+ZD/pvalbCA vqHTOV1pR/5FWR+X+iq8zTsgnicuI8fD7++55UXlDQUC4mhxMXhENgHIDO8vP7d+Who4 mY8IhdB0StTilowPnmhMeBXMnbQuNGHPfpCX5e/VjesOPWrgxkzSiex5AxddfyVA+uR+ HfcG/T2GUpiTqCIG6sE6mfItNcD692IRztU1W/hKtExMnhryviYpXCWPaC9b8B+slwjJ Diz6Q2eCQ4RGHFV1H3EMpho+gmfFA+RTn6WUIF/RHe+NzBPIIJUpAKEV/w+jUwGTZBDc 2eJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=S5v+DipCYjKetPPz6/+HLl16R221oH+bNOTlG6ddslo=; b=YqtPR6tUdLARV8G7qBIqGPrLNS6r4vzHJ8lBJbZXAcx383lTAl71kaPiOOZ/tSk7mJ GuYdmOnoMI5iJywNEZCSJTia64PONSZfRiR7sz5ZGTd+F2us5U061MIiZu2NNIGgUOXk KfXp3nBMBCaZgh0yuyOsSLTnq6SjBvMujVItd9H+ZKbAKBWEWMntFqG5Aitq74oxcOa4 jVHnTAH3hCnNRa69m5H1TFpN0Ifik1NJTP0wzkc7KAPZl76VY06pBzBu7le53tl0SBJv rxYF01jV3s6b371PT1dKnQ5Jke/vGHluchjgWEwBx5uTNotcIRhfqN56jYFqQpVTTCmB eNDw== X-Gm-Message-State: ANoB5pkfUs16iuWA8QGSzMPr4Bo0CJZh6MqieezjXxRpPDo0e2dYxiAm CrfJ3pEgxKQzVfJyBcC6TJxPIUh9WAK/SEV0 X-Received: by 2002:a17:90a:4fc1:b0:213:16b5:f45e with SMTP id q59-20020a17090a4fc100b0021316b5f45emr78327338pjh.170.1669957192972; Thu, 01 Dec 2022 20:59:52 -0800 (PST) Received: from localhost.localdomain ([240d:1a:cf7:5800:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id z27-20020aa7949b000000b00575fbe1cf31sm3234456pfk.67.2022.12.01.20.59.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Dec 2022 20:59:52 -0800 (PST) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Jerome Forissier , Masahisa Kojima Subject: [PATCH v3 2/5] eficonfig: use u16_strsize() to get u16 string buffer size Date: Fri, 2 Dec 2022 13:59:34 +0900 Message-Id: <20221202045937.7846-3-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221202045937.7846-1-masahisa.kojima@linaro.org> References: <20221202045937.7846-1-masahisa.kojima@linaro.org> 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.6 at phobos.denx.de X-Virus-Status: Clean Use u16_strsize() to simplify the u16 string buffer size calculation. Signed-off-by: Masahisa Kojima Reviewed-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas --- No update since v1. cmd/eficonfig.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c index 5529edc85e..88d507d04c 100644 --- a/cmd/eficonfig.c +++ b/cmd/eficonfig.c @@ -452,8 +452,7 @@ struct efi_device_path *eficonfig_create_device_path(struct efi_device_path *dp_ struct efi_device_path *dp; struct efi_device_path_file_path *fp; - fp_size = sizeof(struct efi_device_path) + - ((u16_strlen(current_path) + 1) * sizeof(u16)); + fp_size = sizeof(struct efi_device_path) + u16_strsize(current_path); buf = calloc(1, fp_size + sizeof(END)); if (!buf) return NULL;