From 06b470b633026bd8fa7567cce6295ac01815b906 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Wed, 14 Dec 2016 16:08:52 +0100 Subject: [PATCH] UPSTREAM: util/cbfstool: Add NULL-ptr check BUG=None BRANCH=None TEST=None Signed-off-by: Patrick Georgi Found-by: Coverity Scan #1323507 Reviewed-on: https://review.coreboot.org/17858 Reviewed-by: Nico Huber Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Change-Id: I8b5caf5423135fe683a24db6700b895a2685cb98 Reviewed-on: https://chromium-review.googlesource.com/420519 Commit-Ready: Furquan Shaikh Tested-by: Furquan Shaikh Reviewed-by: Furquan Shaikh --- util/cbfstool/cbfs_image.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c index e1a0e8c858..ee229b365d 100644 --- a/util/cbfstool/cbfs_image.c +++ b/util/cbfstool/cbfs_image.c @@ -175,7 +175,8 @@ static int cbfs_file_get_compression_info(struct cbfs_file *entry, uint32_t *decompressed_size) { unsigned int compression = CBFS_COMPRESS_NONE; - *decompressed_size = ntohl(entry->len); + if (decompressed_size) + *decompressed_size = ntohl(entry->len); for (struct cbfs_file_attribute *attr = cbfs_file_first_attr(entry); attr != NULL; attr = cbfs_file_next_attr(entry, attr)) {