[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdUPO+W=Fs+F1vo9+2EqRargK-XXO7+L=k5U8NXP=BHiEg@mail.gmail.com>
Date: Fri, 26 Jun 2015 11:19:16 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Kees Cook <keescook@...omium.org>
Cc: Fengguang Wu <fengguang.wu@...el.com>,
Bryan Wu <cooloney@...il.com>,
Ricardo Ribalda Delgado <ricardo.ribalda@...il.com>,
Sakari Ailus <sakari.ailus@....fi>,
Richard Purdie <rpurdie@...ys.net>,
Linux LED Subsystem <linux-leds@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Christopher Li <sparse@...isli.org>
Subject: Re: [PATCH v3] led/led-class: Handle LEDs with the same name
On Tue, Jun 9, 2015 at 12:55 AM, Kees Cook <keescook@...omium.org> wrote:
>> commit 95420c349194d1b570270ba1b1567d85461761c3
>> Author: Kees Cook <keescook@...omium.org>
>> AuthorDate: Mon Sep 16 11:15:54 2013 -0700
>> Commit: Kees Cook <keescook@...omium.org>
>> CommitDate: Wed Mar 4 14:07:18 2015 -0800
>>
>> Make all format string problems fail the build
>>
>> In an effort to stop format strings from leaking into various callers,
>> have gcc stop the build when this gets detected.
>>
>> Signed-off-by: Kees Cook <keescook@...omium.org>
>>
>> diff --git a/Makefile b/Makefile
>> index e6a9b1b..b7684d2 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -402,7 +402,6 @@ KBUILD_CPPFLAGS := -D__KERNEL__
>> KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
>> -fno-strict-aliasing -fno-common \
>> -Werror-implicit-function-declaration \
>> - -Wno-format-security \
>> -std=gnu89
>>
>> KBUILD_AFLAGS_KERNEL :=
>> @@ -752,6 +751,11 @@ endif
>> NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
>> CHECKFLAGS += $(NOSTDINC_FLAGS)
>>
>> +# Enable format-security when it can stop the build, otherwise disable.
>> +KBUILD_CFLAGS += $(call cc-option,\
>> + -Wformat -Wformat-security -Werror=format-security,\
>> + -Wno-format-security)
>> +
>> # warn about C99 declaration after statement
>> KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
>>
>
> The trouble is that gcc still has a terrible time with false positives
> on these warnings. It doesn't know to silence const char strings. For
> example:
>
> const char * version = "SomeThing driver v1.3\n";
While the contents of the string are const, the pointer isn't...
> ...
> printk(version);
... hence gcc cannot be sure version hasn't been changed to point
to something different.
> We don't care about this, since the string is not dynamic, but gcc
> still warns. My intention is that when gcc fixes this bug, then I'd
> upstream this patch. Right now I have to carry a patch to silence
> false positives. :(
Does it help if you change it to:
const char * const version = "SomeThing driver v1.3\n";
???
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists