From a2ce710df749f06bcdfa95329491046870f3c729 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Wed, 14 Dec 2016 16:08:52 +0100 Subject: util/cbfstool: Add NULL-ptr check Change-Id: I8b5caf5423135fe683a24db6700b895a2685cb98 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 --- util/cbfstool/cbfs_image.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'util') 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)) { -- cgit v1.2.3