mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-11 05:52:36 +02:00
util/nvmutil: only swap/copy if checksum is valid
in practise, the file was never written unless the checksum was valid, but in the same of sloccount reduction i made it do the swap/copy before checking. while functionally ok, it never sat right with me. this is one example of where sloc count doesn't mean everything. code correctness is critical Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -205,16 +205,18 @@ cmd_brick(void)
|
||||
void
|
||||
cmd_swap(void)
|
||||
{
|
||||
xorswap(gbe[0], gbe[1]); /* speedhack: swap ptr, not words */
|
||||
gbeFileModified = nvmPartModified[0] = nvmPartModified[1]
|
||||
= validChecksum(1) | validChecksum(0);
|
||||
if (gbeFileModified)
|
||||
xorswap(gbe[0], gbe[1]); /* speedhack: swap ptr, not words */
|
||||
}
|
||||
|
||||
void
|
||||
cmd_copy(void)
|
||||
{
|
||||
gbe[part ^ 1] = gbe[part]; /* speedhack: copy ptr, not words */
|
||||
gbeFileModified = nvmPartModified[part ^ 1] = validChecksum(part);
|
||||
if (gbeFileModified)
|
||||
gbe[part ^ 1] = gbe[part]; /* speedhack: copy ptr, not words */
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
Reference in New Issue
Block a user