[coreboot-gerrit] New patch to review for coreboot: 61703df nvramtool: Close file after use

Patrick Georgi (patrick@georgi-clan.de) gerrit at coreboot.org
Sun Aug 3 12:12:31 CEST 2014


Patrick Georgi (patrick at georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6475

-gerrit

commit 61703dfe008d8f353a1a9b9a93a347fd2bbc53d3
Author: Patrick Georgi <patrick at georgi-clan.de>
Date:   Sun Aug 3 12:10:53 2014 +0200

    nvramtool: Close file after use
    
    mmap builds a new reference to the file, so the file
    descriptor isn't necessary anymore. Close it.
    
    Change-Id: I639fd13ff8f13cbdfce1d199d75744e56f2b19b3
    Found-by: Coverity Scan
    Signed-off-by: Patrick Georgi <patrick at georgi-clan.de>
---
 util/nvramtool/cbfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/util/nvramtool/cbfs.c b/util/nvramtool/cbfs.c
index febe0be..abd40ee 100644
--- a/util/nvramtool/cbfs.c
+++ b/util/nvramtool/cbfs.c
@@ -144,6 +144,7 @@ void open_cbfs(const char *filename)
 	}
 	cbfs_mapped = mmap(NULL, cbfs_stat.st_size, PROT_READ | PROT_WRITE,
 			MAP_SHARED, cbfs_fd, 0);
+	close(cbfs_fd);
 	if (cbfs_mapped == MAP_FAILED) {
 		printf("Couldn't map '%s'\n", filename);
 		exit(-1);



More information about the coreboot-gerrit mailing list