From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Sun, 18 Apr 2021 08:45:17 -0400 Subject: [PATCH] env: increment redund flag on read fail In-Reply-To: <20201217231918.40164-1-brandon.maier@rockwellcollins.com> References: <20201217231918.40164-1-brandon.maier@rockwellcollins.com> Message-ID: <20210418124517.GK1310@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 Thu, Dec 17, 2020 at 05:19:18PM -0600, Brandon Maier wrote: > If one of the reads fails when importing redundant environments (a > single read failure), the env_flags wouldn't get initialized in > env_import_redund(). If a user then calls saveenv, the new environment > will have the wrong flags value. So on the next load the new environment > will be ignored. > > While debugging this, I also noticed that env/sf.c was not correctly > handling a single read failure, as it would not check the crc before > assigning it to gd->env_addr. > > Having a special error path for when there is a single read failure > seems unnecessary and may lead to future bugs. Instead collapse the > 'single read failure' error to be the same as a 'single crc failure'. > That way env_check_redund() either passes or fails, and if it passes we > are guaranteed to have checked the CRC. > > Signed-off-by: Brandon Maier > CC: Joe Hershberger > CC: Wolfgang Denk > CC: Heiko Schocher > Reviewed-by: Tom Rini 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: