From: Fengguang Wu <fengguang.wu@intel.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Colin King <colin.king@canonical.com>,
Li Bin <huawei.libin@huawei.com>,
Russell King <rmk+kernel@arm.linux.org.uk>,
Will Deacon <will.deacon@arm.com>,
linux-kernel@vger.kernel.org, Kees Cook <keescook@google.com>
Subject: Re: [PATCH] scripts: recordmcount: fix incorrect use of sprintf
Date: Wed, 6 Jan 2016 19:28:54 +0800 [thread overview]
Message-ID: <20160106112854.GA20574@wfg-t540p.sh.intel.com> (raw)
In-Reply-To: <20160104104246.636bc47a@gandalf.local.home>
Hi Steven,
On Mon, Jan 04, 2016 at 10:42:46AM -0500, Steven Rostedt wrote:
> On Wed, 30 Dec 2015 23:06:41 +0000
> Colin King <colin.king@canonical.com> wrote:
>
> > From: Colin Ian King <colin.king@canonical.com>
> >
> > Fix build warning:
> >
> > scripts/recordmcount.c:589:4: warning: format not a string
> > literal and no format arguments [-Wformat-security]
> > sprintf("%s: failed\n", file);
> >
> > Fixes: a50bd43935586 ("ftrace/scripts: Have recordmcount copy the object file")
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > ---
> > scripts/recordmcount.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c
> > index 301d70b..e1675927 100644
> > --- a/scripts/recordmcount.c
> > +++ b/scripts/recordmcount.c
> > @@ -586,7 +586,7 @@ main(int argc, char *argv[])
> > do_file(file);
> > break;
> > case SJ_FAIL: /* error in do_file or below */
> > - sprintf("%s: failed\n", file);
> > + fprintf(stderr, "%s: failed\n", file);
>
> Paper bag bug. I'm not sure how this passed my tests? My tests check
> for warnings. And I even got a "BUILD SUCCESS" from Fengguang Wu's
> kbuild test robot.
Because the error will only show up on "gcc -Wformat-security".
It tend to raise false positives, so Kees setup a dedicated tree
which enables -Wformat-security as well as quieting the common false
positives. In that way Kees can catch such problems from time to time,
however the limitation is, only upstreamed code can be tested in Kees'
tree.
> I'll apply it, test it, and push it out soon.
Thanks,
Fengguang
next prev parent reply other threads:[~2016-01-06 11:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-30 23:06 Colin King
2016-01-04 15:42 ` Steven Rostedt
2016-01-06 11:28 ` Fengguang Wu [this message]
2016-01-06 23:13 ` Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160106112854.GA20574@wfg-t540p.sh.intel.com \
--to=fengguang.wu@intel.com \
--cc=colin.king@canonical.com \
--cc=huawei.libin@huawei.com \
--cc=keescook@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk+kernel@arm.linux.org.uk \
--cc=rostedt@goodmis.org \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®