linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [RFC] build: Enable -Wformat -Wformat-security in maintainer mode
Date: Mon, 29 Dec 2014 19:11:03 +0100	[thread overview]
Message-ID: <1739197.NJi8TVCMF6@leonov> (raw)
In-Reply-To: <DB100955-4134-4A34-A293-21B10D1B494C@holtmann.org>

Hi Marcel,

On Monday 29 of December 2014 09:42:46 Marcel Holtmann wrote:
> Hi Szymon,
> 
> > __attribute__((format(printf))) doesn't seem to catch missing format
> > string in function call ie.
> > 
> > char *p = "foo";
> > 
> > printf(p);
> > vs
> > printf("%s", p);
> > 
> > Enabling -Wformat -Wformat-security warns in such case.
> > ---
> > 
> > This should allow to early catch bugs like those fixed in
> > patch "Add missing format specifiers in src/error.c" sent by
> > Mariusz.
> > 
> > acinclude.m4 | 1 +
> > 1 file changed, 1 insertion(+)
> > 
> > diff --git a/acinclude.m4 b/acinclude.m4
> > index 960d54c..bc39c6d 100644
> > --- a/acinclude.m4
> > +++ b/acinclude.m4
> > @@ -21,6 +21,7 @@ AC_DEFUN([COMPILER_FLAGS], [
> > 
> > 		with_cflags="$with_cflags -Wredundant-decls"
> > 		with_cflags="$with_cflags -Wcast-align"
> > 		with_cflags="$with_cflags -Wswitch-enum"
> > 
> > +		with_cflags="$with_cflags -Wformat -Wformat-security"
> > 
> > 		with_cflags="$with_cflags -DG_DISABLE_DEPRECATED"
> > 		with_cflags="$with_cflags -
DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_28"
> > 		with_cflags="$with_cflags -
DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_28"
> 
> no objections from my side. However I had gcc versions where this one was
> enabled by default.

It looks like Ubuntu 13.04 and newer enable format-security by default.
Maybe some other distros do the same, yet at least F20 doesn't.

-- 
BR
Szymon Janc

  reply	other threads:[~2014-12-29 18:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-29 12:49 [RFC] build: Enable -Wformat -Wformat-security in maintainer mode Szymon Janc
2014-12-29 14:32 ` Luiz Augusto von Dentz
2014-12-29 17:42 ` Marcel Holtmann
2014-12-29 18:11   ` Szymon Janc [this message]
2015-01-02 17:03 ` Szymon Janc

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=1739197.NJi8TVCMF6@leonov \
    --to=szymon.janc@tieto.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    /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;
as well as URLs for NNTP newsgroup(s).