Fix the behavior of undefined commands in BlockImageVerify
In BlockImageVerify some commands are undefined, e.g. "erase", "new", "zero". And we should not error out if the corresponding function pointer of these commands is null; otherwise we will fail the verification. The old code is: if (cmd->f != nullptr && cmd->f(params) == -1) return false; In the last_command_file change the logic was wrongly modified to if (cmd->f == nullptr) return false; ... if (cmd->f(params) == -1) return false; Test: sideload an incremental OTA twice on bullhead Change-Id: I2561c365badb850da0e416629ccd61f0df7da5d7
This commit is contained in:
@@ -1727,9 +1727,11 @@ static Value* PerformBlockImageUpdate(const char* name, State* state,
|
||||
|
||||
const Command* cmd = cmd_map[params.cmdname];
|
||||
|
||||
// Skip the command if we explicitly set the corresponding function pointer to nullptr, e.g.
|
||||
// "erase" during block_image_verify.
|
||||
if (cmd->f == nullptr) {
|
||||
LOG(ERROR) << "failed to find the function for command [" << line << "]";
|
||||
goto pbiudone;
|
||||
LOG(DEBUG) << "skip executing command [" << line << "]";
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip all commands before the saved last command index when resuming an update.
|
||||
|
||||
Reference in New Issue
Block a user