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 17C80C433EF for ; Sat, 5 Mar 2022 01:03:17 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3702E83B63; Sat, 5 Mar 2022 02:03:15 +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="GAPEZreM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DD6DC83B75; Sat, 5 Mar 2022 02:03:13 +0100 (CET) Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) (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 776E083B49 for ; Sat, 5 Mar 2022 02:03:10 +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=takahiro.akashi@linaro.org Received: by mail-pf1-x431.google.com with SMTP id t5so9000826pfg.4 for ; Fri, 04 Mar 2022 17:03:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=wxFszxZoLx/QyS1t5R3xHBon0iL8wN3eg6sQSHae/3c=; b=GAPEZreMroZSUC9a0XGeWEBSkmCFpIi2jnRSQUug3eVZL+phvjYlUHwFJ3rWXkevi6 hANKzuEdi59eEgI8OSpnNkRI5AWfsIS+jRJGrA4G3JkQcICfX9bGD17o2HASkJ6p8Enn akpNf3RJcK9kDLr33agByzcSVS8/OwxhL068dQEz0DlW8STRjxubgUSeYQukTm8svUPS QX3UPlX6Ls58CmleRNABOsSH2xtZAZY8znKsAsJabevevM068iGF06nujguzMram36b8 3stfSEqOBUdm90pPSJQ96UzaDC+9xV8eEfb4V9FeqKpYbGjKjSvRwmB8QSA1u0XEPyZG m2zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=wxFszxZoLx/QyS1t5R3xHBon0iL8wN3eg6sQSHae/3c=; b=FuKkWMFwXjr5g1WG+hj/n60/yWLFwYaRCwdOLDUThZaKFDTofq/2diWgXoo5Dt4B21 3APcoXH/2XE4xP1sYJXuS+Apkv8y5rtL8jtxMYZzAjcWSFSkI+Bxh7LitCDsb9J2ugPz OdKd1erW1jlEy2ygsoHGu2Qv940NewHSfcMZC/K3oAFETmCGr/ZXDGFktMkkjXF+WdCD p7Hx1CqeblCB0EsP6Rx0fK0QsHpQ5dnQ2U1jZRDCVadLkbfiUlI61EM4RQsMtFQIHWCO 5R6ng8v0x2viwNvKlq1aDcgFh13DPG80lhSCRofpD1OOV+Qk7/1+6wmMoYC28gZYCJiH x1hA== X-Gm-Message-State: AOAM533c6GQVd8i44H3g2ulXtoa19vvAC/tP6EVJJXi/e//rehbjWUxL eflwrjkO56HIxJEayj0T9qXTLA== X-Google-Smtp-Source: ABdhPJwXtT7CWiKJBnKE52LZPMx2Qo8pBcQKftXjLNWATWGvFqNR+QhXvGlaEHSVsO6xkfBSPv3Gjg== X-Received: by 2002:a63:2a53:0:b0:372:cb6d:3d61 with SMTP id q80-20020a632a53000000b00372cb6d3d61mr861987pgq.575.1646442188759; Fri, 04 Mar 2022 17:03:08 -0800 (PST) Received: from laputa ([2400:4050:c3e1:100:ecc0:b732:9096:3f16]) by smtp.gmail.com with ESMTPSA id 132-20020a62168a000000b004f40e8b3133sm7642426pfw.188.2022.03.04.17.03.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Mar 2022 17:03:08 -0800 (PST) Date: Sat, 5 Mar 2022 10:03:05 +0900 From: AKASHI Takahiro To: Heinrich Schuchardt Cc: u-boot@lists.denx.de, Ilias Apalodimas Subject: Re: [PATCH 1/1] efi_loader: remove efi_disk_is_system_part() Message-ID: <20220305010305.GA6345@laputa> Mail-Followup-To: AKASHI Takahiro , Heinrich Schuchardt , u-boot@lists.denx.de, Ilias Apalodimas References: <20220304235100.43127-1-heinrich.schuchardt@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220304235100.43127-1-heinrich.schuchardt@canonical.com> 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 Heinrich, On Sat, Mar 05, 2022 at 12:51:00AM +0100, Heinrich Schuchardt wrote: > The block IO protocol may be installed on any handle. We should make > no assumption about the structure the handle points to. > > efi_disk_is_system_part() makes an illegal widening cast from a handle > to a struct efi_disk_obj. Remove the function. NAK. If this is a problem, please fix the function rather than remove it. > As side effect capsules might be read from non-ESP partitions. UEFI specification requires that capsules be loaded from ESP. -Takahiro Akashi > > Fixes: Fixes: 41fd506842c2 ("efi_loader: disk: add efi_disk_is_system_part()") > Signed-off-by: Heinrich Schuchardt > --- > include/efi_loader.h | 2 -- > lib/efi_loader/efi_capsule.c | 4 +++- > lib/efi_loader/efi_disk.c | 29 ----------------------------- > 3 files changed, 3 insertions(+), 32 deletions(-) > > diff --git a/include/efi_loader.h b/include/efi_loader.h > index e390d323a9..5ac736ebce 100644 > --- a/include/efi_loader.h > +++ b/include/efi_loader.h > @@ -539,8 +539,6 @@ efi_status_t tcg2_measure_pe_image(void *efi, u64 efi_size, > int efi_disk_create_partitions(efi_handle_t parent, struct blk_desc *desc, > const char *if_typename, int diskid, > const char *pdevname); > -/* Check if it is EFI system partition */ > -bool efi_disk_is_system_part(efi_handle_t handle); > /* Called by bootefi to make GOP (graphical) interface available */ > efi_status_t efi_gop_register(void); > /* Called by bootefi to make the network interface available */ > diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c > index 613b531b82..2e7474a5d0 100644 > --- a/lib/efi_loader/efi_capsule.c > +++ b/lib/efi_loader/efi_capsule.c > @@ -684,7 +684,9 @@ static bool device_is_present_and_system_part(struct efi_device_path *dp) > if (!handle) > return false; > > - return efi_disk_is_system_part(handle); > + /* TODO: add system partition check */ > + > + return true; > } > > /** > diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c > index 45127d1768..97223537a1 100644 > --- a/lib/efi_loader/efi_disk.c > +++ b/lib/efi_loader/efi_disk.c > @@ -587,32 +587,3 @@ efi_status_t efi_disk_register(void) > > return EFI_SUCCESS; > } > - > -/** > - * efi_disk_is_system_part() - check if handle refers to an EFI system partition > - * > - * @handle: handle of partition > - * > - * Return: true if handle refers to an EFI system partition > - */ > -bool efi_disk_is_system_part(efi_handle_t handle) > -{ > - struct efi_handler *handler; > - struct efi_disk_obj *diskobj; > - struct disk_partition info; > - efi_status_t ret; > - int r; > - > - /* check if this is a block device */ > - ret = efi_search_protocol(handle, &efi_block_io_guid, &handler); > - if (ret != EFI_SUCCESS) > - return false; > - > - diskobj = container_of(handle, struct efi_disk_obj, header); > - > - r = part_get_info(diskobj->desc, diskobj->part, &info); > - if (r) > - return false; > - > - return !!(info.bootable & PART_EFI_SYSTEM_PARTITION); > -} > -- > 2.34.1 >