[PATCH] env: Fix warning when forcing environment without ENV_ACCESS_IGNORE_FORCE

Fuzzey, Martin martin.fuzzey at flowbird.group
Thu Jan 28 20:37:08 CET 2021


Hi Marek,

On Thu, 28 Jan 2021 at 20:07, Marek Vasut <marex at denx.de> wrote:
>
> Based on env/Kconfig  description of this option:
>
> config ENV_ACCESS_IGNORE_FORCE
>          bool "Block forced environment operations"
>          default n
>          help
>            If defined, don't allow the -f switch to env set override
> variable
>            access flags.
>
> I would think the code should look like this:
>
> #ifdef CONFIG_ENV_ACCESS_IGNORE_FORCE
>          if (flag & H_FORCE) {
>                  printf("## Error: Can't force access to \"%s\"\n", name);
>                  return 1;
>          }
> #else
>          if (flag & H_FORCE)
>                 return 0;
> #endif

I don't think that is right.

If you do that force update will be refused when
CONFIG_ENV_ACCESS_IGNORE_FORCE, regardless if the access would be
valid without the force

The kconfig options says don't allow the -f switch to OVERRIDE
variable access flags, not "don't allow the -f switch to be used"

I think we want this truth table

-f used      ENV_ACCESS_IGNORE _FORCE     Access valid         ====>    result
N                 X
    N                                         refused
N                 X
    Y                                         accepted
Y                 N
    Y                                         accepted
Y                 N
    N                                         accepted (forced)
Y                 Y
    Y                                          accepted
Y                 Y
    N                                          refused with warning

Regards,

Martin

-- 



Martin Fuzzey | Software Architect
Transport Intelligence Division
Parc La Fayette - 6 rue Isaac Newton | Besançon | 25075 | FR
Office: +33381546880 Mobile: +33677158582
martin.fuzzey at flowbird.group | www.flowbird.group/transport


More information about the U-Boot mailing list