From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EDBFA21883E for ; Wed, 6 May 2026 09:14:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778058846; cv=none; b=jazQXCjW1iZ5K1E9ffUM5Q76c70uxLJUCEjHlB2TOEesSUCWzEg5oqOwEMl9jlz6IVoKnYmdzfpXHkVRv/wTAnKsSRJgIbHkw2Is2oGtW/cBsefGkttEuSk8NPao2ssqoHM51myL/KwDnq4eE7HBCSZsKJeHW2VYh9UpdpjP6AY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778058846; c=relaxed/simple; bh=cxgrZwC6w+nshX9meyrHQoGbt1rgs1/MA3K6BVRlzWw=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=W/7qZAsdFU5OiihoqYE1D9iiQuZXvu5OLO7QC4qRfuU6ASPXO0po6f5whOQzG+KLMWpcuGQvoIxPnTfWT7G8YtVFu/+DH1UvnakeG0GHDd/BfZYUCc72szuN4IZS/9vTprX4ljTbeLZhjYI2ViryQPGrtFtA2Mp7q5wdGk/JRgc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=OK9vqYKi; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="OK9vqYKi" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 27F074E42C07 for ; Wed, 6 May 2026 09:14:01 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id DC21A6053C; Wed, 6 May 2026 09:14:00 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 5BD46102F18EA; Wed, 6 May 2026 11:13:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1778058840; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=Uw/WwAAJAS0STqfxRRKJuJ1zAdXDPwuMVVYqwnVPLTw=; b=OK9vqYKiesj5Vh9KsRito3z4BS5jBsOUCOmlIPx1UsJuXrhqH55VJP7id1/BkZbL4Pg2Dh zg9KY8r1sIj98evtNfMho2cjuZmdX/1dTAM4HjRlP6qHHz1FM8BL4sKcL8MFS1f7sOwzgp QFgUBiparPbC9FRZU1MSvJPT2OQWqoPBKOu2dJtThA2KbmiBx6GAjtWEMq4d8NmgcVrK3q wuqE00e1IZVAYzieqPV7kTvetcrt4HrZ9Y6yJsOTFwwk1wyzeKsyFCwuFmYPx22bn8pRJh ZEDpvS1tox8Ew4ASzA3ZzFlXfP2dwlcooi7zlMAscBLnLZBGrKjxdxnljUurFA== From: Miquel Raynal To: Rosen Penev Cc: linux-kernel@vger.kernel.org, =?utf-8?Q?Rafa=C5=82_Mi=C5=82ecki?= , Srinivas Kandagatla Subject: Re: [PATCH] nvmem: layouts: u-boot-env: remove ethaddr check In-Reply-To: (Rosen Penev's message of "Wed, 29 Apr 2026 14:41:36 -0700") References: <20260428212621.60759-1-rosenp@gmail.com> <87wlxqcj06.fsf@bootlin.com> <87qznycit9.fsf@bootlin.com> User-Agent: mu4e 1.12.7; emacs 30.2 Date: Wed, 06 May 2026 11:13:58 +0200 Message-ID: <87ik90nbmx.fsf@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 On 29/04/2026 at 14:41:36 -07, Rosen Penev wrote: > On Wed, Apr 29, 2026 at 12:44=E2=80=AFAM Miquel Raynal > wrote: >> >> On 29/04/2026 at 09:39:53 +02, Miquel Raynal = wrote: >> >> > Hi Rosen, >> > >> >> --- a/drivers/nvmem/layouts/u-boot-env.c >> >> +++ b/drivers/nvmem/layouts/u-boot-env.c >> >> @@ -75,11 +75,9 @@ static int u_boot_env_parse_cells(struct device *d= ev, struct nvmem_device *nvmem >> >> info.offset =3D data_offset + value - data; >> >> info.bytes =3D strlen(value); >> >> info.np =3D of_get_child_by_name(dev->of_node, info.name= ); >> >> - if (!strcmp(var, "ethaddr")) { >> >> - info.raw_len =3D strlen(value); >> >> - info.bytes =3D ETH_ALEN; >> >> - info.read_post_process =3D u_boot_env_read_post_= process_ethaddr; >> >> - } >> >> + info.raw_len =3D strlen(value); >> >> + info.bytes =3D ETH_ALEN; >> > >> > How do you know this is a MAC address? >> >> You are overwriting info.bytes above. I am sorry but this change has >> only been tested with your very own settings and does not look like >> something we could accept. >> >> You cannot attach the "process ethaddr" subprocess to any node, that >> would not make any sense. >> >> I guess we can extend a bit the condition with thinks like "eth%daddr", >> but that must remain limited. > how about a static array of the names and strcmp over that? You can check for eth on the first offsets, and then addr starting from offset 4, allowing up to 10 ethernet interfaces to by dynamically assigned, that should be enough. If not enough, you can also try at offset 5, which would bring that up to 100 possible interfaces. I belive you can directly give the strings to strcmp, no need for a global declaration. Thanks, Miqu=C3=A8l