From patchwork Wed Nov 23 07:17:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 627916 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2966434pvb; Tue, 22 Nov 2022 23:17:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf5MoE2OwQJIr5dchO7BU1Mgnng52KHq6J/ja4eoL4qyeVhhpqGoUsjYH6AL+Im8ou920pPc X-Received: by 2002:a02:c892:0:b0:374:fc28:28e with SMTP id m18-20020a02c892000000b00374fc28028emr12464573jao.190.1669187849957; Tue, 22 Nov 2022 23:17:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669187849; cv=none; d=google.com; s=arc-20160816; b=lZDFKvUAcjPB3fBmkGhKvHMoPq7EN+1WUbKDCA4p8rNVkHTjgm+D/KG9Wb4JPUyhz+ /MlORISFrYobi/sgEE1jwbLb1II76BdhhbD7tSMr9ptGj/VbKc+EXPTQ1TtHZfp8KbY+ bqe5JGdnTAan8KxZNkOnLukoZTwjXIGXJa3bFwsJXLUiMuLNnFTzoqbtgIUxUkVXS+QT kKQiDfVw13f1oBYVz/3e2/uc7Qd05U7RI1o2pRs7WFtMI5UbYPQkR7lbPPr+kur6zDgl HFEAM3TB8KwWSfTd4tV0nMpDOtilF8SmR15mh5fZwrq1dkv1QKxkmhLHRrukcJkKnvSp bPoA== 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=pA2BxIpOl7nuMZWQDxJYWhL5Bx/DlhTtOWIOJcB0eyM=; b=qA9SUfJUnkJET2BNJkUqFzFEkkhR71iQOGOqFYHm7c+orrz5BS1VkSNjz9g46fdAm5 3ZYHGXIP5SRusQFVRcZxNXckK1EfZFJQX97dW7H97cEtTa+rPPf5dqg5wytL+Cc7Mi9a Zf+9rAE2tRdXlVfCsPTGpXNg5WSQgNXciN0zIhAzmvsrYraFJ4wc/C2Ik5Uws/dQ7WJ/ gvdm0UDKTinaUBiwO3p2D3hhcrb0j+7uM7nsmEIK9zFG6bJJffcqKPqLEpLUOl4TOxdn l8e8Z04ACkmhlOg323XCFWRApR7hCexLR28MOL2FJed8CNahbIOZ0yClNq2YC7jsQxll xpzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SjrMO6Vm; 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 g7-20020a056602150700b006de38a11c2fsi13511873iow.77.2022.11.22.23.17.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 23:17:29 -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=SjrMO6Vm; 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 E42A385554; Wed, 23 Nov 2022 08:17: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="SjrMO6Vm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 552A48554C; Wed, 23 Nov 2022 08:17:18 +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-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) (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 1348B85411 for ; Wed, 23 Nov 2022 08:17:16 +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-pf1-x42e.google.com with SMTP id w129so188764pfb.5 for ; Tue, 22 Nov 2022 23:17:15 -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=pA2BxIpOl7nuMZWQDxJYWhL5Bx/DlhTtOWIOJcB0eyM=; b=SjrMO6VmWMTjQcduLIrvPSM+I2YO5s4qI5FyGMdpdJPHXQTp8CSeMKjNvmIxBW2UKk gXQqepSBVMOVFO8PNMKGgNrGQ/GK/5vpr2XFFlGrtzIXd+lLX/9j7Jp5jAP53J0hWUAi QxLQmAuNRMYX9jB/2PA5TV57EZyXQAb5lObNatRA4Oau3GtQDsimU5tARt46LFl60ODD MX2Q/toLS0Rqi82BsPT/+VCyDm6YrbdpFGNAlrfiMHegWxvudM3kC65zdD3SEUVh20lp 4qFkXrS3ogCZ1fi3Pe3ilfVptMKG//O9w7VSiVX+RJ1neQNjobOSiK3DmgYPilf5yWGv IVsw== 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=pA2BxIpOl7nuMZWQDxJYWhL5Bx/DlhTtOWIOJcB0eyM=; b=ZtQNJZ31TXSX7Br9IRFxU1rLNLqHXFIKxvGMmwK4ags8KqODQ/jsJhVM9+ME1mdg45 5Q5eMTW1plocyTUzp71iGBuY0pMHlE46aCd+8SWpbuCOHSybDveS+8Ukcj1sfW0ejFbY C6qxRvfnPD8obTqhjs88Ez+EiR81tJdWHZm83160FSS4UgxDU+7ZLx+6Cy0alSKDwl2j MuAOqu0deLSpg4piseMiImooymgeyseXc0Ak5pIOHc/fzN3W4xVePXa4y96dKi3GVoNG RZENSAUZZmz0PvEtFO3EmUk87yGmytx6LYn18bhSMgwTBkpDVGaBExme++2V/GrLfZ1a L1YQ== X-Gm-Message-State: ANoB5pld6v7wXm91EyS4csv+SGVzfF7NWUPRTdIAdubKrSl9NbqGQO0Y zG8G2jKJ/Zixnvx5qG7XoiHgmGD3bhVwCQ== X-Received: by 2002:a63:e4a:0:b0:477:6cd0:9a04 with SMTP id 10-20020a630e4a000000b004776cd09a04mr12371803pgo.433.1669187834084; Tue, 22 Nov 2022 23:17:14 -0800 (PST) Received: from localhost.localdomain ([240d:1a:cf7:5800:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id n20-20020a170902d0d400b0016d72804664sm5512863pln.205.2022.11.22.23.17.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 23:17:13 -0800 (PST) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Masahisa Kojima Subject: [PATCH 1/3] eficonfig: fix going one directory up issue Date: Wed, 23 Nov 2022 16:17:08 +0900 Message-Id: <20221123071710.28506-2-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221123071710.28506-1-masahisa.kojima@linaro.org> References: <20221123071710.28506-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 The directory name in eficonfig menu entry contains the '\' separator. strcmp() argument ".." is wrong and one directory up handling does not work correctly. strcmp() argument must include '\' separator. Signed-off-by: Masahisa Kojima --- cmd/eficonfig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c index 97d35597a2..5529edc85e 100644 --- a/cmd/eficonfig.c +++ b/cmd/eficonfig.c @@ -488,7 +488,7 @@ static efi_status_t eficonfig_file_selected(void *data) if (!info) return EFI_INVALID_PARAMETER; - if (!strcmp(info->file_name, "..")) { + if (!strcmp(info->file_name, "..\\")) { struct eficonfig_filepath_info *iter; struct list_head *pos, *n; int is_last; From patchwork Wed Nov 23 07:17:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 627917 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2966521pvb; Tue, 22 Nov 2022 23:17:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf4XW2tCeYlGpogrQs6eeUNbNphX9aYS/i+KVTtoNOq85CbmlV19qfN/MZBhTLYMFEx9tl/B X-Received: by 2002:a05:6e02:12c2:b0:302:e38e:761b with SMTP id i2-20020a056e0212c200b00302e38e761bmr287358ilm.61.1669187861316; Tue, 22 Nov 2022 23:17:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669187861; cv=none; d=google.com; s=arc-20160816; b=RztMCQ9Ccf5h3VxGnTwBADQBmQcQLxsEWhXO26keVs3pV+IAL25cgIr0M3gPge62II 5xoonfdHsJl2hnQvYhYnjK+nAKcysDLRPjzmQfAnhxCld2P4xAPIQe65iABDYZS2vu8/ 7IagSRXcyMhweYCbMo4AXPRn3l6O39dXnobHsEVWizOntM3sbULn+G/6P1uP8eA3AGgk l/2rOe9Pc43O91TkAuiOMBva+0rgqk9Ve5znsT7hHa1FYXi/YOV/NOarDlGlbfTNjqC+ NcPpcs4sNIKAyDNhXuOyahn3IEmj10t51Ijxfknat2RRcGDO9ktcfUnYXspyZ2yE6Jvq Ecnw== 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=pXDpghEsNMFUqpw/YcptGLuFQtSZlh02WqwTvFNapMg=; b=bLTVsyIalAmNpdOOvTJGMRPJ8SfyWyZUj86qgjEDIkFi5ecGQ+RmADQd69U6IrXRWo T1Dps6g/OwmVHoiMRZmd4Mylf4n/3JNufuw9yA7XuL7+OU56sFrzkFNGPaRAzAKEQGKv odhLpeOvI8+TAZyB86bRtGu3a8d7bKNotnKT6xLtTFxdvY9q3PmtJjQoSjpNjrh+61LM QyjPPv+7Z0xnqjwcx1DiUmwYjlv4eA8+USGrciJL6C08KcXezO47UjYdHlUX17fk8snD 3kT9dbE1i8DmnHFm2gLSeh6/LYFT5pbaNdWC4WXTOuVMBNpYqeWXX06f3A6njSoKtgym AWVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=snUkGT6i; 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 c9-20020a92cf49000000b00300e56f28b9si8041618ilr.139.2022.11.22.23.17.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 23:17:41 -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=snUkGT6i; 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 062918554C; Wed, 23 Nov 2022 08:17:23 +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="snUkGT6i"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9CC8085565; Wed, 23 Nov 2022 08:17:21 +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-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) (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 01DB685411 for ; Wed, 23 Nov 2022 08:17: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=masahisa.kojima@linaro.org Received: by mail-pl1-x62a.google.com with SMTP id d6so2362843pll.7 for ; Tue, 22 Nov 2022 23:17:18 -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=pXDpghEsNMFUqpw/YcptGLuFQtSZlh02WqwTvFNapMg=; b=snUkGT6iTVNsHulxF54BbdfyeaD3u9S+t3Ge783Et0dYevEvzj9Arm+8yoejPevEgi rf4TvX1DpuV7r71LUCZYi+QOTxcDbD/A7eV41CJGrQ027ZhGEYSWsvbHaj1EKiVtMchR NW34ASpquVyhjOcPZSdSG9LhOpjtux9BH1pZnv+q0XxtOyHgWcOLl2oYB9u3Vcw2A9Ma yb4tHpt+b41AvKs1syVRmp+VGa+F4HENbSonfU6Fpz5utDFHkho+4u2i31wN/HmDKLyn bD6ZaaYSoAi46CIsxhq0DKE2U0uDiBl+3wfILEIlAiHGBukt89KxiZMTOZjUraYsGBJ5 8PpA== 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=pXDpghEsNMFUqpw/YcptGLuFQtSZlh02WqwTvFNapMg=; b=ewLhhxaAsVnRpX0IMqW+TS8/C/AggVEHU4UodGlugGqrPnLfHEhoma6KJjR+jsM83z nnGEpWDhpxEJTAIeiHM97yv0tVCDYcQR6M8cUcgmNo9cFi3JsCxb0odm0XseqOwPeYnG FRzqC1U0TTLzd2MrP6oPIpxWdrpAKkrUD2Ye04x2faRU0ZOfd+0+nQLVM0eZe38kDKbo eT5ak6Dhs0O5g4hiEFY3DRqitdcOqQylj2GrAmtxZrE3DJvgH8fkKXcV5RnwJGaL8TX7 onG2sePJ3UX2PEN5M1jRhC9Fkk5wRFjEXbJVNXZT6mykeDzmpasWOC+CVqkAVT3sKOE1 sjSQ== X-Gm-Message-State: ANoB5pkmGdxFEvG86kK3FxTc7sNvx2ss7tIRyYBsAewQilZ2kP7Fz35X BvcHasr4Mqj2vq899ZPSotGjCX9qmj+GOA== X-Received: by 2002:a17:90a:1a11:b0:213:f398:ed51 with SMTP id 17-20020a17090a1a1100b00213f398ed51mr28930236pjk.216.1669187837038; Tue, 22 Nov 2022 23:17:17 -0800 (PST) Received: from localhost.localdomain ([240d:1a:cf7:5800:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id n20-20020a170902d0d400b0016d72804664sm5512863pln.205.2022.11.22.23.17.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 23:17:16 -0800 (PST) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Masahisa Kojima , Simon Glass , =?utf-8?q?Pali_Roh=C3=A1r?= , Ovidiu Panait , Ashok Reddy Soma Subject: [PATCH 2/3] cmd: add maximum boot option index Kconfig option Date: Wed, 23 Nov 2022 16:17:09 +0900 Message-Id: <20221123071710.28506-3-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221123071710.28506-1-masahisa.kojima@linaro.org> References: <20221123071710.28506-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 eficonfig command reads the all possible UEFI boot options from 0x0000 to 0xFFFF to construct the menu. This takes too much time in some environment, especially for the platform using OP-TEE and RPMB based secure storage. For example, on Socionext Developerbox, it takes more than 30 seconds to draw the boot option menu. To reduce the time to draw the menu, this patch introduces the maximum UEFI boot option index that eficonfig can manage. Signed-off-by: Masahisa Kojima --- cmd/Kconfig | 12 ++++++++++++ cmd/eficonfig.c | 10 +++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/cmd/Kconfig b/cmd/Kconfig index 1092fb9c91..3978a5ef30 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1981,6 +1981,18 @@ config CMD_EFICONFIG Enable the 'eficonfig' command which provides the menu-driven UEFI variable maintenance interface. +config EFICONFIG_BOOT_OPTION_MAX_INDEX + int "Maximum index of UEFI Boot Option" + depends on CMD_EFICONFIG + default 99 + help + Define the number of boot option entry that 'eficonfig' command + can manage. + In UEFI specification, the boot option is indexed from 0x0000 + to 0xFFFF. 'eficonfig' command read the boot option from uefi + variable storage, reading all possible boot option may + significantly affect the performance of boot option enumeration. + config CMD_EXCEPTION bool "exception - raise exception" depends on ARM || RISCV || SANDBOX || X86 diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c index 5529edc85e..20b9a29d3a 100644 --- a/cmd/eficonfig.c +++ b/cmd/eficonfig.c @@ -1079,7 +1079,7 @@ efi_status_t eficonfig_get_unused_bootoption(u16 *buf, efi_uintn_t buf_size, if (buf_size < u16_strsize(u"Boot####")) return EFI_BUFFER_TOO_SMALL; - for (i = 0; i <= 0xFFFF; i++) { + for (i = 0; i <= CONFIG_EFICONFIG_BOOT_OPTION_MAX_INDEX; i++) { size = 0; efi_create_indexed_name(buf, buf_size, "Boot", i); ret = efi_get_variable_int(buf, &efi_global_variable_guid, @@ -1090,7 +1090,7 @@ efi_status_t eficonfig_get_unused_bootoption(u16 *buf, efi_uintn_t buf_size, break; } - if (i > 0xFFFF) + if (i > CONFIG_EFICONFIG_BOOT_OPTION_MAX_INDEX) return EFI_OUT_OF_RESOURCES; *index = i; @@ -1708,7 +1708,7 @@ static efi_status_t eficonfig_show_boot_selection(unsigned int *selected) } /* list the remaining load option not included in the BootOrder */ - for (i = 0; i <= 0xFFFF; i++) { + for (i = 0; i <= CONFIG_EFICONFIG_BOOT_OPTION_MAX_INDEX; i++) { /* If the index is included in the BootOrder, skip it */ if (search_bootorder(bootorder, num, i, NULL)) continue; @@ -2007,7 +2007,7 @@ static efi_status_t eficonfig_create_change_boot_order_entry(struct efimenu *efi } /* list the remaining load option not included in the BootOrder */ - for (i = 0; i < 0xFFFF; i++) { + for (i = 0; i < CONFIG_EFICONFIG_BOOT_OPTION_MAX_INDEX; i++) { if (efi_menu->count >= EFICONFIG_ENTRY_NUM_MAX - 2) break; @@ -2278,7 +2278,7 @@ efi_status_t eficonfig_delete_invalid_boot_option(struct eficonfig_media_boot_op u16 varname[] = u"Boot####"; efi_status_t ret = EFI_SUCCESS; - for (i = 0; i <= 0xFFFF; i++) { + for (i = 0; i <= CONFIG_EFICONFIG_BOOT_OPTION_MAX_INDEX; i++) { efi_uintn_t tmp; efi_create_indexed_name(varname, sizeof(varname), "Boot", i); From patchwork Wed Nov 23 07:17:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 627918 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2966604pvb; Tue, 22 Nov 2022 23:17:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf7XzdrdHurYaySdesl/Cix3D5R8a1cQ3xKH+H6lRUNd7aI2iRDQTV2aLfXpP6pyEeiLze/g X-Received: by 2002:a05:6e02:1d9e:b0:302:4aef:5792 with SMTP id h30-20020a056e021d9e00b003024aef5792mr4137895ila.202.1669187874982; Tue, 22 Nov 2022 23:17:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669187874; cv=none; d=google.com; s=arc-20160816; b=r3dEbbhKDnKb0xelrqOCe78T6U0tXimDqkkmfKn9CkUDD6OiQGS/OdKOuEDZHz1j3s dGrarlnr5OmvuUKsMpKjwvO7z8RdkZUDjVsnMp3LHuQ516t8nLoZjpEBUWKHlV8JiN52 P+AS2/PIlAnxCnkTffzDoEEq2l4lVHr17cpV+LyV4br7C7b7tYQ5ICH5NdzpJJUdgbAY bVprtDiPUsP9jUQ/vwyHr6YueTW+PymcYL/B/2OaXljzmc8+shA/BmpKwq5oHRPm0EOh dOAzTWq797/FhJfzLpiA+Qz46kS2+/foJCFgMBhCx1QJjb7uZlE+ouFXlGAw3Z0fCFyl TdYw== 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=/BocOUr9JthWTTm0jJZqi/ebdvJ0LXP0/XZL4Rvg0t8=; b=wuRh4ysmf+968kMGR/Zr4KNgmn4p9dIsL6GjlLZ9UbVs2PomCVrDapWBXLXUA3XLlN 7bUKHdgoQ1i16RyR89PFxXV8qqRznlW8yRChLk0uDt5lOK7qwCOsezAPmBlTgawv8Y5g sK5gybzcWxKob5356GOghaq36VVwJK4xQ1i9BnUZAERm+y34mHXJcYA/xDtPPqJc19HD 5yOxnmYvbm5m1laILA5NwfVjihRoJGSwdw76nHGSxaGBNhzsSDf8bLqKH/fiXxo2CXXZ kDWSYIxZFWhJokFao6iw2bldUnX1IAcaefS1f+89OwXwRBgHa06wdCDfPBnSijFWbGx9 uzbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZhO36lPh; 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 q35-20020a027b23000000b00371bd058965si9193455jac.83.2022.11.22.23.17.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 23:17:54 -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=ZhO36lPh; 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 F2BDF85411; Wed, 23 Nov 2022 08:17:25 +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="ZhO36lPh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A8ABD85568; Wed, 23 Nov 2022 08:17:23 +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-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) (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 2FBF48517E for ; Wed, 23 Nov 2022 08:17:21 +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-x1034.google.com with SMTP id a22-20020a17090a6d9600b0021896eb5554so1156170pjk.1 for ; Tue, 22 Nov 2022 23:17:21 -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=/BocOUr9JthWTTm0jJZqi/ebdvJ0LXP0/XZL4Rvg0t8=; b=ZhO36lPhEiDDmd0kL0J/2qMUiPdypZGszvN7vwd8u2AtAAOt9Y38zvKlRJT5SyaOVk alfMcE3Xl8527Fav7iHX0m3gHNAN577zOy59TrK1ldyRL6iwsTAbR2K3wPmUIXZHR2bz W7dJ6SFRpzu8iyN1lkA/Gj1MC6ieDpdpcGO37MbJBEZkHuBTs3F8GDutSfvz6kGJ/DVV Jd+roOBfC+hZsnoVvsFcDUmHgqRCilyFHB63BItUjrrHQhy3IzJXJVXski/TAU4ZAgyd e2ibeAR4ALoa3Y3q8WJ4BHecEYLeJtxUokqs455P7K70HHXN4W9X9TZlhgfsD0KBIEFG srQw== 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=/BocOUr9JthWTTm0jJZqi/ebdvJ0LXP0/XZL4Rvg0t8=; b=KmV3x3S2BdmsMxt9+IgLtd9oXZfJe+PuKaDnH8tnEz3/uqkmW/6n5y8pCUqDoIwPQx T/VLX1aOkws1eAa1OcFe8wT8g/jScFvQbzIFL/I4dnUZIMDWM2rEZQdxdPyx+QGoXXOO V1qq9mMzH8Fh2fKwJMcjOhLiYtPF7cENU8pmuWN+a2gBlGLKSi/B+M4Sc3u1aIMXpt4D E5yQhdCbRCvH1XiyjHARfoD0hgvJrlm4xbduXZHqjYxY6adXNfHmd/Efx0p9pj9EXQMW j5L4xzPv6ezreX5zQeG4UWmlk4mgF99cEy3FHYKWQ+9JYTQ5za3fKgF5T6mOuy89ccVI d2zQ== X-Gm-Message-State: ANoB5pm2l09m9mNF8BezqQOnVVQqNO8ZD2kzVYC+6t6Z8Cn/evuDYcpC Y+8vTwdECKf4krdbwWdrFtEo1NJ/moDJdQ== X-Received: by 2002:a17:90b:3c4c:b0:218:a8a1:933a with SMTP id pm12-20020a17090b3c4c00b00218a8a1933amr15427413pjb.14.1669187839189; Tue, 22 Nov 2022 23:17:19 -0800 (PST) Received: from localhost.localdomain ([240d:1a:cf7:5800:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id n20-20020a170902d0d400b0016d72804664sm5512863pln.205.2022.11.22.23.17.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 23:17:18 -0800 (PST) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Masahisa Kojima Subject: [PATCH 3/3] eficonfig: use u16_strsize() to get u16 string buffer size Date: Wed, 23 Nov 2022 16:17:10 +0900 Message-Id: <20221123071710.28506-4-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221123071710.28506-1-masahisa.kojima@linaro.org> References: <20221123071710.28506-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 --- cmd/eficonfig.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c index 20b9a29d3a..282b5d2cf2 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;