summaryrefslogtreecommitdiff
path: root/src/drivers/intel
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2016-03-08 11:01:17 -0600
committerAaron Durbin <adurbin@chromium.org>2016-03-09 16:46:52 +0100
commit40672becaa44a0d71f6a312335cc4c028d60199b (patch)
treea2714f085ee3f4ded29efdff6d6c6cea2db8afac /src/drivers/intel
parentac1c9ece23f9b0c7cdba3de68614a1081a3016b3 (diff)
drivers/intel/fsp2_0: don't leak resources
rdev_mmap() was not followed by rdev_munmap(), thus leaking resources. Fix the leak. Change-Id: Ibdd30d6b64616038013b4bb748f2ad4a98db5472 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/13958 Reviewed-by: Furquan Shaikh <furquan@google.com> Tested-by: build bot (Jenkins) Reviewed-by: Andrey Petrov <andrey.petrov@intel.com>
Diffstat (limited to 'src/drivers/intel')
-rw-r--r--src/drivers/intel/fsp2_0/util.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/drivers/intel/fsp2_0/util.c b/src/drivers/intel/fsp2_0/util.c
index 4fd4f689a3..da8aa9c271 100644
--- a/src/drivers/intel/fsp2_0/util.c
+++ b/src/drivers/intel/fsp2_0/util.c
@@ -95,11 +95,20 @@ enum cb_err fsp_load_binary(struct fsp_header *hdr,
/* Map just enough of the file to be able to parse the header. */
membase = rdev_mmap(&file_data, FSP_HDR_OFFSET, FSP_HDR_LEN);
+
+ if (membase == NULL) {
+ printk(BIOS_ERR, "Could not mmap() '%s' FSP header.\n", name);
+ return CB_ERR;
+ }
+
if (fsp_identify(hdr, membase) != CB_SUCCESS) {
+ rdev_munmap(&file_data, membase);
printk(BIOS_ERR, "%s did not have a valid FSP header\n", name);
return CB_ERR;
}
+ rdev_munmap(&file_data, membase);
+
fsp_print_header_info(hdr);
/* Check if size specified in the header matches the cbfs file size */