Skip to content

Commit 46fe94a

Browse files
triniMichal Marek
authored and
Michal Marek
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. Signed-off-by: Tom Rini <trini@konsulko.com> Signed-off-by: Michal Marek <mmarek@suse.com>
1 parent a043934 commit 46fe94a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scripts/basic/fixdep.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,11 @@ static void do_config_file(const char *filename)
274274
perror(filename);
275275
exit(2);
276276
}
277-
fstat(fd, &st);
277+
if (fstat(fd, &st) < 0) {
278+
fprintf(stderr, "fixdep: error fstat'ing config file: ");
279+
perror(filename);
280+
exit(2);
281+
}
278282
if (st.st_size == 0) {
279283
close(fd);
280284
return;

0 commit comments

Comments
 (0)