diff options
author | Marshall Dawson <marshalldawson3rd@gmail.com> | 2019-03-13 14:43:17 -0600 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2019-03-15 12:57:57 +0000 |
commit | 02bd77379bec15ecbbe4f931d19112d267ef4607 (patch) | |
tree | acb1e65c79a673373e49392c0aab5b355fd06a92 /util/amdfwtool/amdfwtool.c | |
parent | d004dac7f6558c309cbe655d2cb2c1fa458364b8 (diff) | |
download | coreboot-02bd77379bec15ecbbe4f931d19112d267ef4607.tar.xz |
util/amdfwtool: Allow 0-length blobs
A side effect of the change 8e0dca05
"util/amdfwtool: Add generic image copy function"
was to treat a read operation of zero bytes as a failure. Some
implementations exist that use zero length files as a means of
removing functionality. This causes amdfwtool to exit with an
error.
Put the zero length capability back in, and generate the requested
table entry with a length field of 0x0.
TEST=Boot google/grunt, inspect PSP directory table
BUG=b:128507639
Change-Id: Ifc9204dbbf6b107f06116362358ab9d22caa71df
Signed-off-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/31891
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-by: Martin Roth <martinroth@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'util/amdfwtool/amdfwtool.c')
-rw-r--r-- | util/amdfwtool/amdfwtool.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c index 376887c2ec..4a13b29c53 100644 --- a/util/amdfwtool/amdfwtool.c +++ b/util/amdfwtool/amdfwtool.c @@ -424,7 +424,7 @@ static void integrate_firmwares(context *ctx, bytes = copy_blob(BUFF_CURRENT(*ctx), fw_table[i].filename, BUFF_ROOM(*ctx)); - if (bytes <= 0) { + if (bytes < 0) { free(ctx->rom); exit(1); } @@ -455,7 +455,7 @@ static void integrate_psp_firmwares(context *ctx, } else if (fw_table[i].filename != NULL) { bytes = copy_blob(BUFF_CURRENT(*ctx), fw_table[i].filename, BUFF_ROOM(*ctx)); - if (bytes <= 0) { + if (bytes < 0) { free(ctx->rom); exit(1); } |