Skip to content

Commit c1420f8

Browse files
committed
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. [ Linux commit : 46fe94a ] Signed-off-by: Tom Rini <trini@konsulko.com> Signed-off-by: Michal Marek <mmarek@suse.com>
1 parent c409bd0 commit c1420f8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

scripts/basic/fixdep.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,11 @@ static void do_config_file(const char *filename)
296296
perror(filename);
297297
exit(2);
298298
}
299-
fstat(fd, &st);
299+
if (fstat(fd, &st) < 0) {
300+
fprintf(stderr, "fixdep: error fstat'ing config file: ");
301+
perror(filename);
302+
exit(2);
303+
}
300304
if (st.st_size == 0) {
301305
close(fd);
302306
return;

0 commit comments

Comments
 (0)