[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1449523568-31084-1-git-send-email-trini@konsulko.com>
Date: Mon, 7 Dec 2015 16:26:08 -0500
From: Tom Rini <trini@...sulko.com>
To: linux-kbuild@...r.kernel.org
Cc: Michal Marek <mmarek@...e.com>, linux-kernel@...r.kernel.org
Subject: [PATCH] kbuild: fixdep: Check fstat(2) return value
Coverity has recently added a check that will find when we don't check
the return code from fstat(2). Copy/paste the checking logic that
print_deps() has with an appropriate re-wording of the perror() message.
Cc: Michal Marek <mmarek@...e.com>
Cc: linux-kbuild@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
Signed-off-by: Tom Rini <trini@...sulko.com>
---
Note that I don't have a CID here was I found this in U-Boot and the
kernel hasn't yet done a build with this test being enabled.
---
scripts/basic/fixdep.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index c68fd61..e3d9678 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -274,7 +274,11 @@ static void do_config_file(const char *filename)
perror(filename);
exit(2);
}
- fstat(fd, &st);
+ if (fstat(fd, &st) < 0) {
+ fprintf(stderr, "fixdep: error fstat'ing config file: ");
+ perror(filename);
+ exit(2);
+ }
if (st.st_size == 0) {
close(fd);
return;
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists