mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-20 05:36:23 +02:00
util/nvmutil: cmd copy/swap: use word/setWord
this means that we make use of the boundary checks. it's just a safer way of handling these functions. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -356,8 +356,8 @@ void
|
|||||||
cmd_copy(void)
|
cmd_copy(void)
|
||||||
{
|
{
|
||||||
err_if(!goodChecksum(part));
|
err_if(!goodChecksum(part));
|
||||||
for (int c = 0; c < SIZE_4KB; c++)
|
for (int c = 0; c < (SIZE_4KB >> 1); c++)
|
||||||
gbe[part ^ 1][c] = gbe[part][c];
|
setWord(c, part ^ 1, word(c, part));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -365,10 +365,10 @@ cmd_swap(void) {
|
|||||||
err_if(!(goodChecksum(0) || goodChecksum(1)));
|
err_if(!(goodChecksum(0) || goodChecksum(1)));
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
||||||
for (int c = 0; c < SIZE_4KB; c++) {
|
for (int c = 0; c < (SIZE_4KB >> 1); c++) {
|
||||||
uint8_t chg = gbe[0][c];
|
uint16_t chg = word(c, 0);
|
||||||
gbe[0][c] = gbe[1][c];
|
setWord(c, 0, word(c, 1));
|
||||||
gbe[1][c] = chg;
|
setWord(c, 1, chg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user