kbuild: fixdep: Check fstat(2) return value
Subsystems (2)
PATCH 1/1 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.
---
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(-)
scripts/basic/fixdep.c +5 -1
@@ -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 ;
Signature · 1 line
1.7.9.5
Quoted 23 lines · Tom Rini
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 theperror()message.Cc Michal Marek <[email protected]>Signed-off-by Tom Rini <[email protected]>---
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(-)scripts/basic/fixdep.c +0
-0@@ -274,7 +274,11 @@ static void do_config_file(const char *filename)perror (filename);exit (2 );
scripts/basic/fixdep.c static void do_config_file(const char *filename) · line 284
Quoted 10 lines
scripts/basic/fixdep.c +5
-1} -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 ;
Adding stable@ since this applies to 4.4. Any comments? Thanks!
Signature · 1 line
Tom
Quoted 30 lines · Tom Rini
Quoted 28 lines · Tom Rini
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 theperror()message.Cc Michal Marek <[email protected]>Signed-off-by Tom Rini <[email protected]>---
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(-)scripts/basic/fixdep.c +3
-1@@ -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);
Quoted 8 lines
scripts/basic/fixdep.c static void do_config_file(const char *filename) · line 284
Quoted 5 lines
scripts/basic/fixdep.c +2
-0+exit (2 ); + }if (st.st_size ==0 ) {close (fd);return ;Adding stable@ since this applies to 4.4. Any comments? Thanks!
Ping? Thanks!
Signature · 1 line
Tom
Quoted 1 line · Tom Rini
Ping? Thanks!
Applied now, thanks.
Michal