summaryrefslogtreecommitdiff
path: root/util/nvmutil
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-03 03:50:22 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-03 03:50:22 +0000
commitefe2635c1216867888d2e01f40f0a2d1c3aefd3f (patch)
treee56d3cf0bae111480acdc5e4753d849fa18e53fa /util/nvmutil
parentc721d6f4f45c8212d79c03b92622ea8850d76bbd (diff)
nvmutil: fix the swap function
irrelevant for most users, who are on little endian anyway, but i broke the swap function on big endian systems. this fixes it. the new function uses an intermediate variable instead of xor swapping, but i accidentally left some relics of of the old xor swaps in place. this fixes that. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/nvmutil')
-rw-r--r--util/nvmutil/nvmutil.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index 8314ba44..dd06a0ca 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -452,8 +452,8 @@ swap(int partnum)
for (size_t w = NVM_SIZE * ((uint8_t *) &e)[0], x = 1;
w < NVM_SIZE; w += 2, x += 2) {
uint8_t chg = n[w];
- n[w] ^= n[x];
- n[x] ^= chg;
+ n[w] = n[x];
+ n[x] = chg;
}
}