All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org,
	Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Michal Marek <michal.lkml@markovi.net>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
	Olof Johansson <olof@lxom.net>,
	Konstantin Ryabitsev <konstantin@linuxfoundation.org>,
	"David S . Miller" <davem@davemloft.net>,
	Andrey Ryabinin <aryabinin@virtuozzo.com>,
	Kees Cook <keescook@chromium.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>,
	Paul Lawrence <paullawrence@google.com>,
	Sandipan Das <sandipan@linux.vnet.ibm.com>,
	Andrey Konovalov <andreyknvl@google.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Will Deacon <will.deacon@arm.com>,
	Philippe Ombredanne <pombredanne@nexb.com>,
	Paul Burton <paul.burton@mips.com>,
	David Rientjes <rientjes@google.com>, Willy Tarreau <w@1wt.eu>,
	Martin Sebor <msebor@gmail.com>,
	Christopher Li <sparse@chrisli.org>,
	Jonathan Corbet <corbet@lwn.net>, Theodore Ts'o <tytso@mit.edu>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Joe Perches <joe@perches.com>, Arnd Bergmann <arnd@arndb.de>,
	Dominique Martinet <asmadeus@codewreck.org>,
	Stefan Agner <stefan@agner.ch>,
	Luc Van Oostenryck <luc.vanoostenryck@gmail.com>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-doc@vger.kernel.org, linux-ext4@vger.kernel.org,
	linux-sparse@vger.kernel.org, linux-kbuild@vger.kernel.org
Subject: [PATCH v5 13/15] Compiler Attributes: enable -Wstringop-truncation on W=1 (gcc >= 8)
Date: Thu, 20 Sep 2018 19:22:59 +0200	[thread overview]
Message-ID: <20180920172301.21868-14-miguel.ojeda.sandonis@gmail.com> (raw)
In-Reply-To: <20180920172301.21868-1-miguel.ojeda.sandonis@gmail.com>

Commit 217c3e019675 ("disable stringop truncation warnings for now")
disabled -Wstringop-truncation since it was too noisy.

Having __nonstring available allows us to let GCC know that a string
is not meant to be NUL-terminated, which helps suppressing some
-Wstringop-truncation warnings.

Note that using __nonstring actually triggers other warnings
(-Wstringop-overflow, which is on by default) which may be real
problems. Therefore, cleaning up -Wstringop-truncation warnings
also buys us the ability to uncover further potential problems.

To encourage the use of __nonstring, we put the warning back at W=1.
In the future, if we end up with a fairly warning-free tree,
we might want to enable it by default.

Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
---
 scripts/Makefile.extrawarn | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 8d5357053f86..b8f36f5f43f2 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -29,6 +29,7 @@ warning-1 += $(call cc-option, -Wmissing-include-dirs)
 warning-1 += $(call cc-option, -Wunused-but-set-variable)
 warning-1 += $(call cc-option, -Wunused-const-variable)
 warning-1 += $(call cc-option, -Wpacked-not-aligned)
+warning-1 += $(call cc-option, -Wstringop-truncation)
 warning-1 += $(call cc-disable-warning, missing-field-initializers)
 warning-1 += $(call cc-disable-warning, sign-compare)
 
-- 
2.17.1


WARNING: multiple messages have this Message-ID (diff)
From: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org,
	Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Michal Marek <michal.lkml@markovi.net>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
	Olof Johansson <olof@lxom.net>,
	Konstantin Ryabitsev <konstantin@linuxfoundation.org>,
	"David S . Miller" <davem@davemloft.net>,
	Andrey Ryabinin <aryabinin@virtuozzo.com>,
	Kees Cook <keescook@chromium.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>,
	Paul Lawrence <paullawrence@google.com>,
	Sandipan Das <sandipan@linux.vnet.ibm.com>,
	Andrey Konovalov <andreyknvl@google.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Will Deac
Subject: [PATCH v5 13/15] Compiler Attributes: enable -Wstringop-truncation on W=1 (gcc >= 8)
Date: Thu, 20 Sep 2018 19:22:59 +0200	[thread overview]
Message-ID: <20180920172301.21868-14-miguel.ojeda.sandonis@gmail.com> (raw)
In-Reply-To: <20180920172301.21868-1-miguel.ojeda.sandonis@gmail.com>

Commit 217c3e019675 ("disable stringop truncation warnings for now")
disabled -Wstringop-truncation since it was too noisy.

Having __nonstring available allows us to let GCC know that a string
is not meant to be NUL-terminated, which helps suppressing some
-Wstringop-truncation warnings.

Note that using __nonstring actually triggers other warnings
(-Wstringop-overflow, which is on by default) which may be real
problems. Therefore, cleaning up -Wstringop-truncation warnings
also buys us the ability to uncover further potential problems.

To encourage the use of __nonstring, we put the warning back at W=1.
In the future, if we end up with a fairly warning-free tree,
we might want to enable it by default.

Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
---
 scripts/Makefile.extrawarn | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 8d5357053f86..b8f36f5f43f2 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -29,6 +29,7 @@ warning-1 += $(call cc-option, -Wmissing-include-dirs)
 warning-1 += $(call cc-option, -Wunused-but-set-variable)
 warning-1 += $(call cc-option, -Wunused-const-variable)
 warning-1 += $(call cc-option, -Wpacked-not-aligned)
+warning-1 += $(call cc-option, -Wstringop-truncation)
 warning-1 += $(call cc-disable-warning, missing-field-initializers)
 warning-1 += $(call cc-disable-warning, sign-compare)
 
-- 
2.17.1

WARNING: multiple messages have this Message-ID (diff)
From: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org,
	Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Michal Marek <michal.lkml@markovi.net>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
	Olof Johansson <olof@lxom.net>,
	Konstantin Ryabitsev <konstantin@linuxfoundation.org>,
	"David S . Miller" <davem@davemloft.net>,
	Andrey Ryabinin <aryabinin@virtuozzo.com>,
	Kees Cook <keescook@chromium.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>,
	Paul Lawrence <paullawrence@google.com>,
	Sandipan Das <sandipan@linux.vnet.ibm.com>,
	Andrey Konovalov <andreyknvl@google.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Will
Subject: [PATCH v5 13/15] Compiler Attributes: enable -Wstringop-truncation on W=1 (gcc >= 8)
Date: Thu, 20 Sep 2018 19:22:59 +0200	[thread overview]
Message-ID: <20180920172301.21868-14-miguel.ojeda.sandonis@gmail.com> (raw)
In-Reply-To: <20180920172301.21868-1-miguel.ojeda.sandonis@gmail.com>

Commit 217c3e019675 ("disable stringop truncation warnings for now")
disabled -Wstringop-truncation since it was too noisy.

Having __nonstring available allows us to let GCC know that a string
is not meant to be NUL-terminated, which helps suppressing some
-Wstringop-truncation warnings.

Note that using __nonstring actually triggers other warnings
(-Wstringop-overflow, which is on by default) which may be real
problems. Therefore, cleaning up -Wstringop-truncation warnings
also buys us the ability to uncover further potential problems.

To encourage the use of __nonstring, we put the warning back at W=1.
In the future, if we end up with a fairly warning-free tree,
we might want to enable it by default.

Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
---
 scripts/Makefile.extrawarn | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 8d5357053f86..b8f36f5f43f2 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -29,6 +29,7 @@ warning-1 += $(call cc-option, -Wmissing-include-dirs)
 warning-1 += $(call cc-option, -Wunused-but-set-variable)
 warning-1 += $(call cc-option, -Wunused-const-variable)
 warning-1 += $(call cc-option, -Wpacked-not-aligned)
+warning-1 += $(call cc-option, -Wstringop-truncation)
 warning-1 += $(call cc-disable-warning, missing-field-initializers)
 warning-1 += $(call cc-disable-warning, sign-compare)
 
-- 
2.17.1

  parent reply	other threads:[~2018-09-20 17:23 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-20 17:22 [PATCH v5 00/15] Compiler Attributes Miguel Ojeda
2018-09-20 17:22 ` Miguel Ojeda
2018-09-20 17:22 ` Miguel Ojeda
2018-09-20 17:22 ` [PATCH v5 01/15] Compiler Attributes: remove unused attributes Miguel Ojeda
2018-09-20 17:22   ` Miguel Ojeda
2018-09-20 17:22   ` Miguel Ojeda
2018-09-20 17:22 ` [PATCH v5 02/15] Compiler Attributes: always use the extra-underscores syntax Miguel Ojeda
2018-09-20 17:22   ` Miguel Ojeda
2018-09-20 17:22   ` Miguel Ojeda
2018-09-20 17:22 ` [PATCH v5 03/15] Compiler Attributes: remove unneeded tests Miguel Ojeda
2018-09-20 17:22   ` Miguel Ojeda
2018-09-20 17:22   ` Miguel Ojeda
2018-09-20 17:22 ` [PATCH v5 04/15] Compiler Attributes: homogenize __must_be_array Miguel Ojeda
2018-09-20 17:22   ` Miguel Ojeda
2018-09-20 17:22   ` Miguel Ojeda
2018-09-20 17:22 ` [PATCH v5 05/15] Compiler Attributes: remove unneeded sparse (__CHECKER__) tests Miguel Ojeda
2018-09-20 17:22   ` Miguel Ojeda
2018-09-20 17:22   ` Miguel Ojeda
2018-09-20 17:22 ` [PATCH v5 06/15] Compiler Attributes: add missing SPDX ID in compiler_types.h Miguel Ojeda
2018-09-20 17:22   ` Miguel Ojeda
2018-09-20 17:22   ` Miguel Ojeda
2018-09-20 17:22 ` [PATCH v5 07/15] Compiler Attributes: use feature checks instead of version checks Miguel Ojeda
2018-09-20 17:22   ` Miguel Ojeda
2018-09-20 17:22   ` Miguel Ojeda
2018-09-20 17:22 ` [PATCH v5 08/15] Compiler Attributes: KENTRY used twice the "used" attribute Miguel Ojeda
2018-09-20 17:22   ` Miguel Ojeda
2018-09-20 17:22   ` Miguel Ojeda
2018-09-20 17:22 ` [PATCH v5 09/15] Compiler Attributes: remove uses of __attribute__ from compiler.h Miguel Ojeda
2018-09-20 17:22   ` Miguel Ojeda
2018-09-20 17:22   ` Miguel Ojeda
2018-09-20 17:22 ` [PATCH v5 10/15] Compiler Attributes: add Doc/process/programming-language.rst Miguel Ojeda
2018-09-20 17:22   ` Miguel Ojeda
2018-09-20 17:22   ` Miguel Ojeda
2018-09-20 17:22 ` [PATCH v5 11/15] Compiler Attributes: add MAINTAINERS entry Miguel Ojeda
2018-09-20 17:22   ` Miguel Ojeda
2018-09-20 17:22   ` Miguel Ojeda
2018-09-20 17:22 ` [PATCH v5 12/15] Compiler Attributes: add support for __nonstring (gcc >= 8) Miguel Ojeda
2018-09-20 17:22   ` Miguel Ojeda
2018-09-20 17:22   ` Miguel Ojeda
2018-09-20 18:07   ` Nick Desaulniers
2018-09-20 18:07     ` Nick Desaulniers
2018-09-20 18:07     ` Nick Desaulniers
2018-09-20 20:08   ` Kees Cook
2018-09-20 20:08     ` Kees Cook
2018-09-20 20:08     ` Kees Cook
2018-09-30 11:16     ` Miguel Ojeda
2018-09-30 11:16       ` Miguel Ojeda
2018-09-20 17:22 ` Miguel Ojeda [this message]
2018-09-20 17:22   ` [PATCH v5 13/15] Compiler Attributes: enable -Wstringop-truncation on W=1 " Miguel Ojeda
2018-09-20 17:22   ` Miguel Ojeda
2018-09-20 18:16   ` Nick Desaulniers
2018-09-20 18:16     ` Nick Desaulniers
2018-09-20 18:16     ` Nick Desaulniers
2018-09-20 19:52   ` Kees Cook
2018-09-20 19:52     ` Kees Cook
2018-09-20 19:52     ` Kees Cook
2018-09-30 11:17     ` Miguel Ojeda
2018-09-30 11:17       ` Miguel Ojeda
2018-09-20 17:23 ` [PATCH v5 14/15] Compiler Attributes: auxdisplay: panel: use __nonstring Miguel Ojeda
2018-09-20 17:23   ` Miguel Ojeda
2018-09-20 17:23   ` Miguel Ojeda
2018-09-20 18:11   ` Nick Desaulniers
2018-09-20 18:11     ` Nick Desaulniers
2018-09-20 18:11     ` Nick Desaulniers
2018-09-20 17:23 ` [PATCH v5 15/15] Compiler Attributes: ext4: remove local __nonstring definition Miguel Ojeda
2018-09-20 17:23   ` Miguel Ojeda
2018-09-20 17:23   ` Miguel Ojeda
2018-09-20 18:13   ` Nick Desaulniers
2018-09-20 18:13     ` Nick Desaulniers
2018-09-20 18:13     ` Nick Desaulniers
2018-09-20 18:18 ` [PATCH v5 00/15] Compiler Attributes Nick Desaulniers
2018-09-20 18:18   ` Nick Desaulniers
2018-09-20 18:18   ` Nick Desaulniers
2018-09-24 14:36 ` Luc Van Oostenryck
2018-09-24 14:36   ` Luc Van Oostenryck
2018-09-30 11:13   ` Miguel Ojeda
2018-09-30 11:13     ` Miguel Ojeda

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=20180920172301.21868-14-miguel.ojeda.sandonis@gmail.com \
    --to=miguel.ojeda.sandonis@gmail.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@google.com \
    --cc=arnd@arndb.de \
    --cc=aryabinin@virtuozzo.com \
    --cc=asmadeus@codewreck.org \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=dwmw2@infradead.org \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=keescook@chromium.org \
    --cc=konstantin@linuxfoundation.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=luc.vanoostenryck@gmail.com \
    --cc=mchehab+samsung@kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=mingo@kernel.org \
    --cc=msebor@gmail.com \
    --cc=ndesaulniers@google.com \
    --cc=olof@lxom.net \
    --cc=paul.burton@mips.com \
    --cc=paullawrence@google.com \
    --cc=pombredanne@nexb.com \
    --cc=rientjes@google.com \
    --cc=rostedt@goodmis.org \
    --cc=sandipan@linux.vnet.ibm.com \
    --cc=sparse@chrisli.org \
    --cc=stefan@agner.ch \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    --cc=w@1wt.eu \
    --cc=will.deacon@arm.com \
    --cc=yamada.masahiro@socionext.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.