From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Rosen Penev <rosenp@gmail.com>
Cc: linux-kernel@vger.kernel.org, "Rafał Miłecki" <rafal@milecki.pl>,
"Srinivas Kandagatla" <srini@kernel.org>
Subject: Re: [PATCH] nvmem: layouts: u-boot-env: remove ethaddr check
Date: Wed, 06 May 2026 11:13:58 +0200 [thread overview]
Message-ID: <87ik90nbmx.fsf@bootlin.com> (raw)
In-Reply-To: <CAKxU2N9uMrcmRGeJSnG_tDR2wjCaEqaoR5B8C5S_L81=aAuBrQ@mail.gmail.com> (Rosen Penev's message of "Wed, 29 Apr 2026 14:41:36 -0700")
On 29/04/2026 at 14:41:36 -07, Rosen Penev <rosenp@gmail.com> wrote:
> On Wed, Apr 29, 2026 at 12:44 AM Miquel Raynal
> <miquel.raynal@bootlin.com> wrote:
>>
>> On 29/04/2026 at 09:39:53 +02, Miquel Raynal <miquel.raynal@bootlin.com> 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 *dev, struct nvmem_device *nvmem
>> >> info.offset = data_offset + value - data;
>> >> info.bytes = strlen(value);
>> >> info.np = of_get_child_by_name(dev->of_node, info.name);
>> >> - if (!strcmp(var, "ethaddr")) {
>> >> - info.raw_len = strlen(value);
>> >> - info.bytes = ETH_ALEN;
>> >> - info.read_post_process = u_boot_env_read_post_process_ethaddr;
>> >> - }
>> >> + info.raw_len = strlen(value);
>> >> + info.bytes = 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èl
prev parent reply other threads:[~2026-05-06 9:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-28 21:26 [PATCH] nvmem: layouts: u-boot-env: remove ethaddr check Rosen Penev
2026-04-29 7:39 ` Miquel Raynal
2026-04-29 7:44 ` Miquel Raynal
2026-04-29 21:41 ` Rosen Penev
2026-05-06 9:13 ` Miquel Raynal [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ik90nbmx.fsf@bootlin.com \
--to=miquel.raynal@bootlin.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rafal@milecki.pl \
--cc=rosenp@gmail.com \
--cc=srini@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox