From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 63693C433FE for ; Thu, 17 Nov 2022 21:49:38 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6F26A84E00; Thu, 17 Nov 2022 22:49:36 +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="Rm4ZLQnJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9998E80431; Thu, 17 Nov 2022 22:49:35 +0100 (CET) Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) (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 3F79F850FA for ; Thu, 17 Nov 2022 22:49:33 +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=ilias.apalodimas@linaro.org Received: by mail-ej1-x62d.google.com with SMTP id k2so8552654ejr.2 for ; Thu, 17 Nov 2022 13:49:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=FVbDTxrCQtDSKRHtDBMho9B4/hLyMIZN/prCkoCHj94=; b=Rm4ZLQnJKvB6e6Oy7rLS7ZreYRTytpICIEnvDpEevpn8b1xgNHhMuVjJT/zlPdu9E/ qz49bhGv832ueEAIT6CeHZImMPCBZjYB9SRk5tTSKrSikykIdzmoA8a/Gzxb2K/qcdYn +WIx/14xbG0J0zNFGp+diIIAMpzV7NHAYSL67G9OFtnifFNxazknzuEDNfVwonb7gyI2 sltmO390uxlw/5YqIUvqP7dxE3fyNT78GSJvyzamr2qB1UuzYoqFeSBSYMSeCUnJiu9A vYo8DU2puHyZe7SeowaHYyzpclVjiES/50JJQ48rB6RjCkI6gIfqaFJxc4HBSQ5hZGfw COaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=FVbDTxrCQtDSKRHtDBMho9B4/hLyMIZN/prCkoCHj94=; b=JwIZJDUr4EdpyVYrRjQUcjat1lPIXvtSf098x1r8pmLXCG9NHAmmNAxPO0uJkbmGh0 rX0aYKx3woM12eekjXMt4cguwmh2941sjEmlBG/Ie7q0HdEvEjGjg+MzaCujyXl5FFdc S7sKCfr/G7WnN1mIo3+fhFXbdhZTxlPiQlGP1/XZMojIZ+0UsM1n/dsIU4LYJqxs6s5O hjfO7Gf/5BCfvmOZ3YThxSvJHz3UHLdQZorJ9NYSd8q/Lbfxw0zzN5o+E+UmDUoJ9YQ2 EZmWTVavDC8DxHVeyFWCHKosKJ5eKDwAJ0Jtt7XnSnIqeH4/f2Zf+5jI1JoHRomjQgjl h98A== X-Gm-Message-State: ANoB5pmVd2pWx0H2lkGZOGdtE6dTZD9YfPtqwapJDnHfTYaV7IHxc3Ng 7udpS5eXxRdK2jpOkg3+B+9X2g== X-Google-Smtp-Source: AA0mqf6GjR2VlztZ4EaTWDQ84oKfh3V1d6UQ3VP0oimq56pZlPYMQo6i7B6F/3BRwwGqzYncLFrgdg== X-Received: by 2002:a17:906:68c:b0:7ad:dcf7:c4f with SMTP id u12-20020a170906068c00b007addcf70c4fmr3690070ejb.631.1668721772782; Thu, 17 Nov 2022 13:49:32 -0800 (PST) Received: from hera (ppp089210068201.access.hol.gr. [89.210.68.201]) by smtp.gmail.com with ESMTPSA id v9-20020a170906292900b007708130c287sm865148ejd.40.2022.11.17.13.49.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 13:49:32 -0800 (PST) Date: Thu, 17 Nov 2022 23:49:29 +0200 From: Ilias Apalodimas To: Masahisa Kojima Cc: u-boot@lists.denx.de, Heinrich Schuchardt , Simon Glass , Takahiro Akashi , Etienne Carriere Subject: Re: [PATCH v9 5/5] eficonfig: add "Show Signature Database" menu entry Message-ID: References: <20221116102820.21021-1-masahisa.kojima@linaro.org> <20221116102820.21021-6-masahisa.kojima@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221116102820.21021-6-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 Hi Kojima-san > +/** > + * prepare_signature_list_menu() - create the signature list menu entry > + * > + * @efimenu: pointer to the efimenu structure > + * @varname: pointer to the variable name > + * @db: pointer to the variable raw data > + * @db_size: variable data size > + * @func: callback of each entry > + * Return: status code > + */ > +static efi_status_t prepare_signature_list_menu(struct efimenu *efi_menu, void *varname, > + void *db, efi_uintn_t db_size, > + eficonfig_entry_func func) > +{ > + u32 num = 0; > + efi_uintn_t size; > + struct eficonfig_sig_data *sg; > + struct efi_signature_list *esl; > + struct efi_signature_data *esd; > + efi_status_t ret = EFI_SUCCESS; > + > + INIT_LIST_HEAD(&efi_menu->list); > + > + esl = db; > + size = db_size; > + while (size > 0) { > + u32 remain; > + > + esd = (struct efi_signature_data *)((u8 *)esl + > + (sizeof(struct efi_signature_list) + > + esl->signature_header_size)); > + remain = esl->signature_list_size - sizeof(struct efi_signature_list) - > + esl->signature_header_size; > + for (; remain > 0; remain -= esl->signature_size) { > + char buf[40]; This is going to hold a GUID right? Isn't buf[37] enough? > + char *title; > + > + if (num >= EFICONFIG_ENTRY_NUM_MAX - 1) { > + ret = EFI_OUT_OF_RESOURCES; > + goto out; > + } > + > + sg = calloc(1, sizeof(struct eficonfig_sig_data)); > + if (!sg) { > + ret = EFI_OUT_OF_RESOURCES; > + goto err; > + } > + > + snprintf(buf, sizeof(buf), "%pUL", &esd->signature_owner); > + title = calloc(1, (strlen(buf) + 1)); Since the lenght will always be static, just use sizeof(buf) > + if (!title) { > + free(sg); > + ret = EFI_OUT_OF_RESOURCES; > + goto err; > + } > + strlcpy(title, buf, strlen(buf) + 1); > + > + sg->esl = esl; > + sg->esd = esd; > + sg->varname = varname; > + ret = eficonfig_append_menu_entry(efi_menu, title, func, sg); > + if (ret != EFI_SUCCESS) { > + free(sg); > + free(title); > + goto err; > + } > + esd = (struct efi_signature_data *)((u8 *)esd + esl->signature_size); > + num++; > + } > + > + size -= esl->signature_list_size; > + esl = (struct efi_signature_list *)((u8 *)esl + esl->signature_list_size); > + } > +out: > + ret = eficonfig_append_quit_entry(efi_menu); > +err: > + return ret; With those Acked-by: Ilias Apalodimas