From: Wolfgang Denk <wd@denx.de>
To: Francis Laniel <francis.laniel@amarulasolutions.com>
Cc: u-boot@lists.denx.de, joe.hershberger@ni.com,
michael@amarulasolutions.com, ondrej@amarulasolutions.com
Subject: Re: [RFC PATCH 1/1] cmd: nvedit: Forbid key to be empty.
Date: Tue, 29 Jun 2021 10:29:06 +0200 [thread overview]
Message-ID: <83528.1624955346@gemini.denx.de> (raw)
In-Reply-To: <20210628193145.796999-2-francis.laniel@amarulasolutions.com>
Dear Francis,
In message <20210628193145.796999-2-francis.laniel@amarulasolutions.com> you wrote:
> Before this patch, it was possible to do the following using setenv:
> setenv '' foo
> Then, on next reboot, U-Boot will not be able to parse environment due to it
> having:
> =foo
>
> Now, if the above command is given, an error message is thrown and environment
> is not modified.
>
> Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
> ---
> cmd/nvedit.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/cmd/nvedit.c b/cmd/nvedit.c
> index d14ba10cef..64b7aef78d 100644
> --- a/cmd/nvedit.c
> +++ b/cmd/nvedit.c
> @@ -262,6 +262,11 @@ static int _do_env_set(int flag, int argc, char *const argv[], int env_flag)
> return 1;
> }
>
> + if (!strlen(name)) {
Instead of calling a library function here you could use the same
shortcut as in the patch you referenced:
if (*name == 0) {
> + printf("## Error: variable name cannot be empty\n");
s/cannot/must not/ ??
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
"The fundamental principle of science, the definition almost, is
this: the sole test of the validity of any idea is experiment."
- Richard P. Feynman
next prev parent reply other threads:[~2021-06-29 8:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210628193145.796999-1-francis.laniel@amarulasolutions.com>
2021-06-28 19:31 ` [RFC PATCH 1/1] cmd: nvedit: Forbid key to be empty Francis Laniel
2021-06-29 8:29 ` Wolfgang Denk [this message]
2021-06-29 16:16 ` Francis Laniel
2021-06-28 19:39 [RFC PATCH 0/1] cmd: nvedit: Forbid environment " Francis Laniel
2021-06-28 19:39 ` [RFC PATCH 1/1] cmd: nvedit: Forbid " Francis Laniel
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=83528.1624955346@gemini.denx.de \
--to=wd@denx.de \
--cc=francis.laniel@amarulasolutions.com \
--cc=joe.hershberger@ni.com \
--cc=michael@amarulasolutions.com \
--cc=ondrej@amarulasolutions.com \
--cc=u-boot@lists.denx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.