From 46fe94ad18aa7ce6b3dad8c035fb538942020f2b Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Mon, 7 Dec 2015 16:26:08 -0500 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. Signed-off-by: Tom Rini Signed-off-by: Michal Marek --- 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 5b327c67a828..caef815d1743 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; -- 2.20.1