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 00651C433F5 for ; Thu, 27 Jan 2022 22:10:21 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CDFAF83563; Thu, 27 Jan 2022 23:10:19 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="N+pxfBmQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 888CC8365D; Thu, 27 Jan 2022 23:10:17 +0100 (CET) Received: from mail-qk1-x734.google.com (mail-qk1-x734.google.com [IPv6:2607:f8b0:4864:20::734]) (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 4946E8349B for ; Thu, 27 Jan 2022 23:10:14 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qk1-x734.google.com with SMTP id j24so1656524qkk.10 for ; Thu, 27 Jan 2022 14:10:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=BuLY+j2emcHIJod4oM5MznwPaelhfS2CRCGI0fS7WuA=; b=N+pxfBmQANK/sGmpcVPPZZ3IZLPnnBX51K3gXoX3M6zsrGfFFD5nQ2fwdAU8ptzVx1 /SPxsbnMQfZhnnLl6ihtm3XrmHdgPjPZ8xpJfRn71PNvF3yNMGBiBiJs8pp/w0vZQ+vM DxRpkzsKXh8dX+Mke0AytoumT2+/12Jvskt9o= 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:references :mime-version:content-disposition:in-reply-to; bh=BuLY+j2emcHIJod4oM5MznwPaelhfS2CRCGI0fS7WuA=; b=3KqOTduaHc2ROx/YAC4xLDq+Bkzavfg8brEa/xtmQu0jPYISWLeDgmOQbxPHNBm8Su fkyBeOMnFcVNxnQXaedU4E1WI+9/p/9Q3kOG43GVq/Y7mfNJXP37PorGB+d5jNH3rTsT P1HlQccqVPSk7i6AHFP0mn1bvCHnRLlR1NrhG29cFZ4cIRKSm+aiTt5JIYEQ3MOe3d41 2Pb7lX04K+KnaUvojka5WVHG2LJKcYMi06pG+LwyebG8QL0FmgJX7a7fh7awpqZK80K2 huNVfsxJlVFLreSQs8zEY5Lc6YKPcIiFMTfJhar6E/HfsE8K26ynnXF0Smd+KZMf0Qa6 SJUw== X-Gm-Message-State: AOAM532+f6IPcOy4mbMfc+R0ubGBqpzTpK0/yOW8c5h0nsxdMsqvBiDN REHUJ0cc+0TQSLWBT1HFcwhbAB/YKvxMkQ== X-Google-Smtp-Source: ABdhPJzjNMgSV5koDje5hC21evX5HufJiQzxTH9lK6L2atoWoeIPkCn73UDBWvYEuQUaKfQaX9OcaA== X-Received: by 2002:a05:620a:22d5:: with SMTP id o21mr4274245qki.218.1643321413039; Thu, 27 Jan 2022 14:10:13 -0800 (PST) Received: from bill-the-cat (2603-6081-7b01-cbda-2ef0-5dff-fedb-a8ba.res6.spectrum.com. [2603:6081:7b01:cbda:2ef0:5dff:fedb:a8ba]) by smtp.gmail.com with ESMTPSA id u16sm2104860qko.130.2022.01.27.14.10.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 14:10:12 -0800 (PST) Date: Thu, 27 Jan 2022 17:10:10 -0500 From: Tom Rini To: Sean Anderson Cc: Matthias Schiffer , u-boot@lists.denx.de, Lukasz Majewski Subject: Re: [PATCH] fastboot: only look up real partition names when no alias exists Message-ID: <20220127221010.GI7515@bill-the-cat> References: <20211216102638.111391-1-matthias.schiffer@ew.tq-group.com> <5759d408-e876-9444-d14a-22bb37aecc14@seco.com> <7df14f127c28ecf6f3cc389820066fb898a630ac.camel@ew.tq-group.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="iO5NTrAl+y2STuOh" Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett 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 --iO5NTrAl+y2STuOh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 27, 2022 at 11:22:12AM -0500, Sean Anderson wrote: >=20 >=20 > On 1/26/22 4:54 AM, Matthias Schiffer wrote: > > On Fri, 2021-12-17 at 18:20 -0500, Sean Anderson wrote: > >> Hi Matthias, > >>=20 > >> On 12/16/21 5:26 AM, Matthias Schiffer wrote: > >> > Having U-Boot look up the passed partition name even though an > >> > alias > >> > exists is unexpected, leading to warning messages (when the alias > >> > name > >> > doesn't exist as a real partition name) or the use of the wrong > >> > partition. > >> >=20 > >> > Change part_get_info_by_name_or_alias() to consider real partitions > >> > names only if no alias of the same name exists, allowing to use > >> > aliases > >> > to override the configuration for existing partition names. > >>=20 > >> Much saner IMO. > >>=20 > >> I think the correct move in the long term is to add a "quiet" > >> parameter to do_get_part_info (and all its helpers). This is OK as an > >> incremental improvement. > >>=20 > >> > Also change one use of strcpy() to strlcpy(). > >> >=20 > >> > Signed-off-by: Matthias Schiffer >> > > > >> > --- > >> > drivers/fastboot/fb_mmc.c | 29 ++++++++++++----------------- > >> > 1 file changed, 12 insertions(+), 17 deletions(-) > >> >=20 > >> > diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c > >> > index 2738dc836e..fb7791d9da 100644 > >> > --- a/drivers/fastboot/fb_mmc.c > >> > +++ b/drivers/fastboot/fb_mmc.c > >> > @@ -104,23 +104,18 @@ static int > >> > part_get_info_by_name_or_alias(struct blk_desc **dev_desc, > >> > const char *name, > >> > struct disk_partition *info) > >> > { > >> > - int ret; > >> > - > >> > - ret =3D do_get_part_info(dev_desc, name, info); > >> > - if (ret < 0) { > >> > - /* strlen("fastboot_partition_alias_") + PART_NAME_LEN > >> > + 1 */ > >> > - char env_alias_name[25 + PART_NAME_LEN + 1]; > >> > - char *aliased_part_name; > >> > - > >> > - /* check for alias */ > >> > - strcpy(env_alias_name, "fastboot_partition_alias_"); > >> > - strlcat(env_alias_name, name, sizeof(env_alias_name)); > >> > - aliased_part_name =3D env_get(env_alias_name); > >> > - if (aliased_part_name !=3D NULL) > >> > - ret =3D do_get_part_info(dev_desc, > >> > aliased_part_name, > >> > - info); > >> > - } > >> > - return ret; > >> > + /* strlen("fastboot_partition_alias_") + PART_NAME_LEN + 1 */ > >> > + char env_alias_name[25 + PART_NAME_LEN + 1]; > >> > + char *aliased_part_name; > >> > + > >> > + /* check for alias */ > >> > + strlcpy(env_alias_name, "fastboot_partition_alias_", > >> > sizeof(env_alias_name)); > >> > + strlcat(env_alias_name, name, sizeof(env_alias_name)); > >> > + aliased_part_name =3D env_get(env_alias_name); > >> > + if (aliased_part_name) > >> > + name =3D aliased_part_name; > >> > + > >> > + return do_get_part_info(dev_desc, name, info); > >> > } > >> >=20 > >> > /** > >> >=20 > >>=20 > >> Reviewed-by: Sean Anderson > >>=20 > >> --Sean > >=20 > >=20 > > Can we get this committed? >=20 > +CC Tom There's a number of fastboot things and I guess I need to see what I can try and review and grab or reassign. --=20 Tom --iO5NTrAl+y2STuOh Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmHzGD8ACgkQFHw5/5Y0 tywK9wv+JaWvJHDtOAfPrYRtvwQ6uFH4XJ6NI6MrLkDAHhmEacS2ELC12CGdyJEx wZhimozL9fCR8Uo83oXurqkxzdkBkIJZrn3P79c6SzZzcLedIGPhEWyrIbMLkYe3 w2OVNk/jDeMULCJRZOAA+312jXhEsCbo6pSHXCsAu5WMft9FmJEV6t3AKeSL+HoI ShXtJD7yNNN1U23FCozNb2WnJ1Wjsne7mvyU5EeXNKUaERas9doQtb++iPbge7kP dBRIcJdx61vEgWxu4IZxs2MkmAp7a55BP2NvG45LZHkDt7pJYHfCi6rKDeH8bX2Z /H0+nZDqI2PhaTNwq27OS0Cgpc/uwbQv+PKeLN3r6CtbwtLbrpiF3fAV+Vh53DAB Gk8mJIqLV4FmHHh0Q/Aky/jTQeQF48+SbFx79xaJtyqbZt5Gr6tIr3+IpgxKX9H8 zGDhagO278bT21OKGAILpmH2E6oTIjREncbk6Bt0BU92a5NTb1oxh+BP6rjllbKj tHMAPpWM =8utN -----END PGP SIGNATURE----- --iO5NTrAl+y2STuOh--