linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: fixdep: Check fstat(2) return value
@ 2015-12-07 21:26 Tom Rini
  2016-01-16 19:14 ` Tom Rini
       [not found] ` <CA+M6bXnTB286iFoSFUneGq=1PCJtmnR_PBrqMeM4eu-Aj1BqMA@mail.gmail.com>
  0 siblings, 2 replies; 4+ messages in thread
From: Tom Rini @ 2015-12-07 21:26 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Michal Marek, linux-kernel

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@suse.com>
Cc: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Tom Rini <trini@konsulko.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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] kbuild: fixdep: Check fstat(2) return value
  2015-12-07 21:26 [PATCH] kbuild: fixdep: Check fstat(2) return value Tom Rini
@ 2016-01-16 19:14 ` Tom Rini
       [not found] ` <CA+M6bXnTB286iFoSFUneGq=1PCJtmnR_PBrqMeM4eu-Aj1BqMA@mail.gmail.com>
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Rini @ 2016-01-16 19:14 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Michal Marek, lk, stable

On Mon, Dec 7, 2015 at 4:26 PM, Tom Rini <trini@konsulko.com> wrote:

> 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@suse.com>
> Cc: linux-kbuild@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Tom Rini <trini@konsulko.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;

Adding stable@ since this applies to 4.4.  Any comments?  Thanks!

-- 
Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kbuild: fixdep: Check fstat(2) return value
       [not found] ` <CA+M6bXnTB286iFoSFUneGq=1PCJtmnR_PBrqMeM4eu-Aj1BqMA@mail.gmail.com>
@ 2016-02-16 15:32   ` Tom Rini
  2016-02-17 21:58     ` Michal Marek
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Rini @ 2016-02-16 15:32 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Michal Marek, lk, stable

On Sat, Jan 16, 2016 at 02:11:16PM -0500, Tom Rini wrote:
> On Mon, Dec 7, 2015 at 4:26 PM, Tom Rini <trini@konsulko.com> wrote:
> 
> > 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@suse.com>
> > Cc: linux-kbuild@vger.kernel.org
> > Cc: linux-kernel@vger.kernel.org
> > Signed-off-by: Tom Rini <trini@konsulko.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;
> 
> 
> Adding stable@ since this applies to 4.4.  Any comments?  Thanks!

Ping?  Thanks!

-- 
Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] kbuild: fixdep: Check fstat(2) return value
  2016-02-16 15:32   ` Tom Rini
@ 2016-02-17 21:58     ` Michal Marek
  0 siblings, 0 replies; 4+ messages in thread
From: Michal Marek @ 2016-02-17 21:58 UTC (permalink / raw)
  To: Tom Rini; +Cc: linux-kbuild, Michal Marek, lk, stable

On Tue, Feb 16, 2016 at 10:32:15AM -0500, Tom Rini wrote:
> Ping?  Thanks!

Applied now, thanks.

Michal

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-17 21:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-07 21:26 [PATCH] kbuild: fixdep: Check fstat(2) return value Tom Rini
2016-01-16 19:14 ` Tom Rini
     [not found] ` <CA+M6bXnTB286iFoSFUneGq=1PCJtmnR_PBrqMeM4eu-Aj1BqMA@mail.gmail.com>
2016-02-16 15:32   ` Tom Rini
2016-02-17 21:58     ` Michal Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).