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 79F64C00140 for ; Wed, 24 Aug 2022 14:17:50 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 02A22847FE; Wed, 24 Aug 2022 16:17:48 +0200 (CEST) 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="BWephchn"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BA241847FF; Wed, 24 Aug 2022 16:17:46 +0200 (CEST) Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) (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 E54AD845C1 for ; Wed, 24 Aug 2022 16:17:43 +0200 (CEST) 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-ed1-x536.google.com with SMTP id t5so22229692edc.11 for ; Wed, 24 Aug 2022 07:17:43 -0700 (PDT) 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; bh=MmLz0NQYeih3Nz2mM2Q9vQS8Z1w+KRSVh5Qf1uM753k=; b=BWephchnLGDnXBcBasiBGtUJPxzi02e1xJd0VBYqHlncHSpNLJVeMQ0R/GcGZPIEz0 UzDP5rT9EA1k0uvMg6BnhbpMuT50czqTyLbnsVBJQcO4X6TUg6Am4upFP/BFNFyE4m6P FB2O8No8HLo1Pix8T8KrF3XaChPth7oGHllNMlLMdGrtIceNB8AJMupCfgWXqURxWusH V0Zqeah6s97yFVqCxni8DEPTDP4ho5iiYSe5Weajgrsx1MzeO18FNIcM4xi+5ZdKsDPj rAa0EhLO2VpOFYpGbzhTmBpMLEQupLUFU/npyXW00rC9bgaHRK+6aemZEXeNK1EiLkag DnIQ== 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; bh=MmLz0NQYeih3Nz2mM2Q9vQS8Z1w+KRSVh5Qf1uM753k=; b=4HdJJQ4Gm8VyCVauvMKiW6s7q285eAuIxYHVSuAVq8nOX9/6SGMqmzYj5MKVFA6hbS f+SSeLLb0qVNuucYXVuhKdW7Q0f8fiwapM4tF+Yhb4PhhNAu4eLAfoJW0murzaC075B0 X2WuGPDSnyoDvVXb2EPzXciIILLt+3DNtySk9ecz+UxsW3D9Z7XISnUHnVU92YUuqLMS 06K2DJkjIFJ67p6nWpR3Dw9spUfvG8VWpB9eYzuD3qRy/e1l+/0VBaGmzFPHVAjc0+RA h7swKore8NZpC+DSiR3wEutnLlveZgMAGZmB/mxV4VieuPNri43YTYbncQIJ9dz1aNco +KWA== X-Gm-Message-State: ACgBeo1EuY3EPfDITXRN/41PBfe8e0hW+DLIDugVMuj0OD1LJZ+tDckm I6SIJXC+5zkTvj5eDZn/8U45izE6+1frmg== X-Google-Smtp-Source: AA6agR6YqCqwLhI+m/O2juq5W2CSGxgxOYSARqF/h8DKixDwOmwt6qW/bSKKaq/3LG6KFQK+t8yVUQ== X-Received: by 2002:a05:6402:4517:b0:443:7fe1:2d60 with SMTP id ez23-20020a056402451700b004437fe12d60mr7860662edb.133.1661350663449; Wed, 24 Aug 2022 07:17:43 -0700 (PDT) Received: from hades ([46.103.15.185]) by smtp.gmail.com with ESMTPSA id lb20-20020a170907785400b007300d771a98sm1205783ejc.175.2022.08.24.07.17.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 07:17:42 -0700 (PDT) Date: Wed, 24 Aug 2022 17:17:39 +0300 From: Ilias Apalodimas To: Masahisa Kojima Cc: u-boot@lists.denx.de, Heinrich Schuchardt , Simon Glass , Takahiro Akashi , Mark Kettenis Subject: Re: [PATCH v13 5/9] bootmenu: add removable media entries Message-ID: References: <20220824063740.5760-1-masahisa.kojima@linaro.org> <20220824063740.5760-6-masahisa.kojima@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220824063740.5760-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, Apologies for doing the review ad-hoc, but the patchset is huge. I'll try to send a more complete email tomorrow [...] > #endif > > diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c > index 537f3f2bbc..92171c4894 100644 > --- a/cmd/eficonfig.c > +++ b/cmd/eficonfig.c > @@ -1786,6 +1786,215 @@ static efi_status_t eficonfig_process_delete_boot_option(void *data) > return ret; > } > > +/** > + * eficonfig_enumerate_boot_option() - enumerate the possible bootable media > + * > + * @opt: pointer to the media boot option structure > + * @volume_handles: pointer to the efi handles > + * @count: number of efi handle > + * Return: status code > + */ > +efi_status_t eficonfig_enumerate_boot_option(struct eficonfig_media_boot_option *opt, > + efi_handle_t *volume_handles, efi_status_t count) > +{ > + u32 i; > + struct efi_handler *handler; > + efi_status_t ret = EFI_SUCCESS; > + > + for (i = 0; i < count; i++) { > + u16 *p; > + u16 dev_name[BOOTMENU_DEVICE_NAME_MAX]; > + char *optional_data; > + struct efi_load_option lo; > + char buf[BOOTMENU_DEVICE_NAME_MAX]; > + struct efi_device_path *device_path; > + > + ret = efi_search_protocol(volume_handles[i], &efi_guid_device_path, &handler); > + if (ret != EFI_SUCCESS) > + continue; > + ret = efi_protocol_open(handler, (void **)&device_path, > + efi_root, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL); > + if (ret != EFI_SUCCESS) > + continue; > + > + ret = efi_disk_get_device_name(volume_handles[i], buf, BOOTMENU_DEVICE_NAME_MAX); > + if (ret != EFI_SUCCESS) > + continue; > + > + p = dev_name; > + utf8_utf16_strncpy(&p, buf, strlen(buf)); > + > + lo.label = dev_name; > + lo.attributes = LOAD_OPTION_ACTIVE; > + lo.file_path = device_path; > + lo.file_path_length = efi_dp_size(device_path) + sizeof(END); > + /* > + * Set the dedicated guid to optional_data, it is used to identify > + * the boot option that automatically generated by the bootmenu. > + * efi_serialize_load_option() expects optional_data is null-terminated > + * utf8 string, so set the "1234567" string to allocate enough space > + * to store guid, instead of realloc the load_option. > + */ > + lo.optional_data = "1234567"; > + opt[i].size = efi_serialize_load_option(&lo, (u8 **)&opt[i].lo); > + if (!opt[i].size) { > + ret = EFI_OUT_OF_RESOURCES; > + free(dev_name); This is a stack allocated variable. > + goto out; > + } > + /* set the guid */ [...] Thanks /Ilias