diff options
author | Hung-Te Lin <hungte@chromium.org> | 2023-03-01 01:34:18 +0000 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-03-01 10:29:57 +0000 |
commit | 217ee70388b33bbed262a8cdf2232b335ec0a380 (patch) | |
tree | bf83d3c97448add130c5ab6b7e3ec75337c5e87e | |
parent | 68ee26bb18e1b51f9ccb48dca0bfed8cd0169367 (diff) | |
download | vboot-217ee70388b33bbed262a8cdf2232b335ec0a380.tar.gz |
futility: updater: Fix platform_ver property on errorfirmware-skyrim-15369.B
The platform_ver property was expected to be within 0..INT_MAX before
the implementation changed from mosys to crossystem (CL:4029537).
So we should return 0 instead of -1 on error.
BUG=b:271115449
TEST=make; run test
BRANCH=None
Change-Id: I772ff53a4a13e17e6cfe8099768dba64b8736ec5
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4297882
Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
-rw-r--r-- | futility/updater_dut.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/futility/updater_dut.c b/futility/updater_dut.c index 102859ae..6cb03727 100644 --- a/futility/updater_dut.c +++ b/futility/updater_dut.c @@ -9,6 +9,7 @@ #ifdef HAVE_CROSID #include <crosid.h> #endif +#include <limits.h> #include "crossystem.h" #include "updater.h" @@ -111,7 +112,13 @@ static int dut_get_wp_hw(struct updater_config *cfg) static int dut_get_platform_version(struct updater_config *cfg) { - return dut_get_property_int("board_id", cfg); + long rev = dut_get_property_int("board_id", cfg); + /* Assume platform version = 0 on error. */ + if (rev < 0) + rev = 0; + if (rev > INT_MAX) + rev = INT_MAX; + return rev; } /* Helper function to return host software write protection status. */ |