From 4c84e077858c809ee80a9a6f9b38185cf7dcded7 Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Sun, 11 Mar 2018 09:56:06 -0700 Subject: crossystem: Fix mosys data length check CL:942031 introduced a check for the length of output returned by mosys. If the output has a trailing newline, then the check failed. Just make sure we get at least as much data as we expect. BUG=b:74439800 BRANCH=none TEST=run crossystem on bob; no 'mosys returned hex data' errors Change-Id: If678b201185dbda869e4e17abae314470f5cef4a Signed-off-by: Randall Spangler Reviewed-on: https://chromium-review.googlesource.com/958286 Reviewed-by: Stefan Reinauer --- host/lib/crossystem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/host/lib/crossystem.c b/host/lib/crossystem.c index 148e793e..f379d228 100644 --- a/host/lib/crossystem.c +++ b/host/lib/crossystem.c @@ -861,9 +861,9 @@ int vb2_read_nv_storage_mosys(struct vb2_context *ctx) if (ExecuteMosys(argv, hexstring, sizeof(hexstring))) return -1; - if (strlen(hexstring) != 2 * nvsize) { + if (strlen(hexstring) < 2 * nvsize) { fprintf(stderr, "mosys returned hex nvdata size %d" - " (expected %d)\n", (int)strlen(hexstring), 2 * nvsize); + " (need %d)\n", (int)strlen(hexstring), 2 * nvsize); return -1; } hexdigit[2] = '\0'; -- cgit v1.2.1