From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Sun, 18 Apr 2021 08:45:22 -0400 Subject: [PATCH] env: Fix warning when forcing environment without ENV_ACCESS_IGNORE_FORCE In-Reply-To: <1610360847-21890-1-git-send-email-martin.fuzzey@flowbird.group> References: <1610360847-21890-1-git-send-email-martin.fuzzey@flowbird.group> Message-ID: <20210418124522.GL1310@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Mon, Jan 11, 2021 at 11:27:20AM +0100, Martin Fuzzey wrote: > 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 Applied to u-boot/master, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: