diff options
author | Martin Fuzzey <martin.fuzzey@flowbird.group> | 2021-05-03 12:49:48 -0500 |
---|---|---|
committer | Praneeth Bajjuri <praneeth@ti.com> | 2021-05-04 22:51:31 -0500 |
commit | 2c54957d5c0f2d5ffa44b4b879d71dad702a048d (patch) | |
tree | 2eee3696c9098d06d5c9aa45c2a5bf6d90916e1b /env | |
parent | 51a19c4274ca897cec279d1b2d883957ab4705c5 (diff) |
env: Fix warning when forcing environment without ENV_ACCESS_IGNORE_FORCE
commit 9636bf8b2e319c0f43453f71131ba70856571d05 upstream.
Since commit 0f036bf4b87e ("env: Warn on force access if ENV_ACCESS_IGNORE_FORCE set")
a warning message is displayed when setenv -f is used WITHOUT
CONFIG_ENV_ACCESS_IGNORE_FORCE, but the variable is set anyway, resulting
in lots of log pollution.
env_flags_validate() returns 0 if the access is accepted, or non zero
if it is refused.
So the original code
#ifndef CONFIG_ENV_ACCESS_IGNORE_FORCE
if (flag & H_FORCE)
return 0;
#endif
was correct, it returns 0 (accepts the modification) if forced UNLESS
IGNORE_FORCE is set (in which case access checks in the following code
are applied). The broken patch just added a printf to the force accepted
case.
To obtain the intent of the patch we need this:
if (flag & H_FORCE) {
#ifdef CONFIG_ENV_ACCESS_IGNORE_FORCE
printf("## Error: Can't force access to \"%s\"\n", name);
#else
return 0;
#endif
}
Fixes: 0f036bf4b87e ("env: Warn on force access if ENV_ACCESS_IGNORE_FORCE set")
Signed-off-by: Martin Fuzzey <martin.fuzzey@flowbird.group>
[s-anna@ti.com: cherry-pick commit '9636bf8b2e31' from v2021.07-rc1]
Signed-off-by: Suman Anna <s-anna@ti.com>
Diffstat (limited to 'env')
-rw-r--r-- | env/flags.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/env/flags.c b/env/flags.c index df4aed26b2..e3e833c433 100644 --- a/env/flags.c +++ b/env/flags.c @@ -563,12 +563,13 @@ int env_flags_validate(const struct env_entry *item, const char *newval, return 1; #endif -#ifndef CONFIG_ENV_ACCESS_IGNORE_FORCE if (flag & H_FORCE) { +#ifdef CONFIG_ENV_ACCESS_IGNORE_FORCE printf("## Error: Can't force access to \"%s\"\n", name); +#else return 0; - } #endif + } switch (op) { case env_op_delete: if (item->flags & ENV_FLAGS_VARACCESS_PREVENT_DELETE) { |