Skip to content

RFC cmd: nvedit: Forbid environment key to be empty.

Francis Laniel u-boot 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 RFC Latest1 patch 2 repliesIn review
  2. v1 RFC1 patch 0 repliesSuperseded

v1 from the cover letter

* Replace call to strlen by test if variable name is '\0'.
* Modify error message printed.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1cmd: nvedit: Forbid key to be empty.cmd/nvedit.c+5 -02 replies

Reviews trailers per patch

The patch has a Reviewed-by or Acked-by.

PatchWolfgang Denk
1/1R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [RFC PATCH v2 0/1] cmd: nvedit: Forbid environment key to be empty.

Hi.

First of all, I hope you are fine and the same for your relatives.

In this patch, I modified the setenv command to decline empty variable name.
Indeed, it was strangely possible to give the following to this command:
setenv '' foo
Which results in the following belonging to environment:
=foo
And which in turns leads to problem while rebooting:
Loading Environment from Flash... Cannot import environment: errno = 22 *** Warning - import failed, using default environment
This error message is due to varname being empty and was added in [1].

With this patch, executing the above command will lead to the following being printed:
## Error: variable name cannot be empty
And the environment will not be changed.

Here is the diffstat for this patch:
Francis Laniel (1):
cmd: nvedit: Forbid key to be empty.

 cmd/nvedit.c | 5 +++++
 1 file changed, 5 insertions(+)

Change since:
v1:
* Replace call to strlen by test if variable name is '\0'.
* Modify error message printed.

If you see any way to improve the patch, feel free to share it.

Best regards.

---
[1] https://u-boot.denx.narkive.com/P4aKxVFu/patch-env-don-t-add-an-empty-key-to-the-env-hashtable

--
2.25.1