[U-Boot] [RFC PATCH v2 1/7] env: Allow unconditional access if H_PROGRAMMATIC is set

Bernhard Nortmann bernhard.nortmann at web.de
Wed Nov 16 11:29:56 CET 2016


This patch modifies env_flags_validate() in such a way that any
operation will *always* be allowed if H_PROGRAMMATIC is present.

Without this change, programmatically changing environment vars
may fail depending on their flags, e.g. when trying to setenv*()
a variable that is marked "read-only".
http://lists.denx.de/pipermail/u-boot/2016-April/250237.html

Notes: H_FORCE may be insufficient for this purpose, as it can be
disabled by CONFIG_ENV_ACCESS_IGNORE_FORCE.
H_PROGRAMMATIC indicates "U-Boot internal" use. By contrast, any
user interaction (from U-Boot prompt or scripts) is expected to
be marked H_INTERACTIVE.

Signed-off-by: Bernhard Nortmann <bernhard.nortmann at web.de>

---

Changes in v2: None

 common/env_flags.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/env_flags.c b/common/env_flags.c
index 921d377..1087f4e 100644
--- a/common/env_flags.c
+++ b/common/env_flags.c
@@ -523,6 +523,8 @@ int env_flags_validate(const ENTRY *item, const char *newval, enum env_op op,
 	}
 
 	/* check for access permission */
+	if (flag & H_PROGRAMMATIC)
+		return 0;
 #ifndef CONFIG_ENV_ACCESS_IGNORE_FORCE
 	if (flag & H_FORCE)
 		return 0;
-- 
2.7.3



More information about the U-Boot mailing list