mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-03-25 13:29:03 +02:00
nvmutil: even stronger double-run protection
Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -746,18 +746,18 @@ good_checksum(unsigned long partnum)
|
|||||||
void
|
void
|
||||||
run_cmd(void)
|
run_cmd(void)
|
||||||
{
|
{
|
||||||
unsigned long cmd_num;
|
unsigned long i = x->i;
|
||||||
struct commands *cmd;
|
void (*run)(void) = x->cmd[i].run;
|
||||||
|
|
||||||
cmd_num = x->i;
|
check_command_num(i);
|
||||||
cmd = &x->cmd[cmd_num];
|
|
||||||
|
|
||||||
check_command_num(cmd_num);
|
if (run == NULL)
|
||||||
|
err(EINVAL, "Command %lu: null ptr", i);
|
||||||
|
|
||||||
if (cmd->run == NULL)
|
run();
|
||||||
err(EINVAL, "Command %lu: null ptr", cmd_num);
|
|
||||||
|
|
||||||
cmd->run();
|
for (i = 0; i < items(x->cmd); i++)
|
||||||
|
x->cmd[i].run = cmd_helper_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user