* [PATCH][next] Makefile: Enable -Wstringop-overflow globally
@ 2023-11-16 3:27 Gustavo A. R. Silva
2023-11-16 11:23 ` Masahiro Yamada
0 siblings, 1 reply; 3+ messages in thread
From: Gustavo A. R. Silva @ 2023-11-16 3:27 UTC (permalink / raw)
To: Masahiro Yamada, Nathan Chancellor, Nick Desaulniers,
Nicolas Schier
Cc: linux-kbuild, linux-kernel, Gustavo A. R. Silva, linux-hardening
It seems that we have finished addressing all the remaining
issues regarding compiler option -Wstringop-overflow. So, we
are now in good shape to enable this compiler option globally.
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
Makefile | 3 +++
| 2 --
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 690cde550acd..452b7d0e19e9 100644
--- a/Makefile
+++ b/Makefile
@@ -985,6 +985,9 @@ NOSTDINC_FLAGS += -nostdinc
# perform bounds checking.
KBUILD_CFLAGS += $(call cc-option, -fstrict-flex-arrays=3)
+# We are now in good shape to enable this option.
+KBUILD_CFLAGS += $(call cc-option, -Wstringop-overflow)
+
# disable invalid "can't wrap" optimizations for signed / pointers
KBUILD_CFLAGS += -fno-strict-overflow
--git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 2fe6f2828d37..1527199161d7 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -106,7 +106,6 @@ KBUILD_CFLAGS += $(call cc-option, -Wunused-const-variable)
KBUILD_CFLAGS += $(call cc-option, -Wpacked-not-aligned)
KBUILD_CFLAGS += $(call cc-option, -Wformat-overflow)
KBUILD_CFLAGS += $(call cc-option, -Wformat-truncation)
-KBUILD_CFLAGS += $(call cc-option, -Wstringop-overflow)
KBUILD_CFLAGS += $(call cc-option, -Wstringop-truncation)
KBUILD_CPPFLAGS += -Wundef
@@ -122,7 +121,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, restrict)
KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned)
KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation)
-KBUILD_CFLAGS += $(call cc-disable-warning, stringop-overflow)
KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation)
ifdef CONFIG_CC_IS_CLANG
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH][next] Makefile: Enable -Wstringop-overflow globally
2023-11-16 3:27 [PATCH][next] Makefile: Enable -Wstringop-overflow globally Gustavo A. R. Silva
@ 2023-11-16 11:23 ` Masahiro Yamada
2023-11-16 14:18 ` Gustavo A. R. Silva
0 siblings, 1 reply; 3+ messages in thread
From: Masahiro Yamada @ 2023-11-16 11:23 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Nathan Chancellor, Nick Desaulniers, Nicolas Schier, linux-kbuild,
linux-kernel, linux-hardening
On Thu, Nov 16, 2023 at 12:27 PM Gustavo A. R. Silva
<gustavoars@kernel.org> wrote:
>
> It seems that we have finished addressing all the remaining
> issues regarding compiler option -Wstringop-overflow. So, we
> are now in good shape to enable this compiler option globally.
>
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> ---
> Makefile | 3 +++
> scripts/Makefile.extrawarn | 2 --
> 2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 690cde550acd..452b7d0e19e9 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -985,6 +985,9 @@ NOSTDINC_FLAGS += -nostdinc
> # perform bounds checking.
> KBUILD_CFLAGS += $(call cc-option, -fstrict-flex-arrays=3)
>
> +# We are now in good shape to enable this option.
Please remove this comment.
It it fine to mention it in the commit log, but
not in the Makefile.
I hope somebody will double-check this patch in CI infrastructure.
> +KBUILD_CFLAGS += $(call cc-option, -Wstringop-overflow)
> +
> # disable invalid "can't wrap" optimizations for signed / pointers
> KBUILD_CFLAGS += -fno-strict-overflow
>
> diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
> index 2fe6f2828d37..1527199161d7 100644
> --- a/scripts/Makefile.extrawarn
> +++ b/scripts/Makefile.extrawarn
> @@ -106,7 +106,6 @@ KBUILD_CFLAGS += $(call cc-option, -Wunused-const-variable)
> KBUILD_CFLAGS += $(call cc-option, -Wpacked-not-aligned)
> KBUILD_CFLAGS += $(call cc-option, -Wformat-overflow)
> KBUILD_CFLAGS += $(call cc-option, -Wformat-truncation)
> -KBUILD_CFLAGS += $(call cc-option, -Wstringop-overflow)
> KBUILD_CFLAGS += $(call cc-option, -Wstringop-truncation)
>
> KBUILD_CPPFLAGS += -Wundef
> @@ -122,7 +121,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, restrict)
> KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned)
> KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
> KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation)
> -KBUILD_CFLAGS += $(call cc-disable-warning, stringop-overflow)
> KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation)
>
> ifdef CONFIG_CC_IS_CLANG
> --
> 2.34.1
>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][next] Makefile: Enable -Wstringop-overflow globally
2023-11-16 11:23 ` Masahiro Yamada
@ 2023-11-16 14:18 ` Gustavo A. R. Silva
0 siblings, 0 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2023-11-16 14:18 UTC (permalink / raw)
To: Masahiro Yamada, Gustavo A. R. Silva
Cc: Nathan Chancellor, Nick Desaulniers, Nicolas Schier, linux-kbuild,
linux-kernel, linux-hardening
On 11/16/23 05:23, Masahiro Yamada wrote:
> On Thu, Nov 16, 2023 at 12:27 PM Gustavo A. R. Silva
> <gustavoars@kernel.org> wrote:
>>
>> It seems that we have finished addressing all the remaining
>> issues regarding compiler option -Wstringop-overflow. So, we
>> are now in good shape to enable this compiler option globally.
>>
>> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
>> ---
>> Makefile | 3 +++
>> scripts/Makefile.extrawarn | 2 --
>> 2 files changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index 690cde550acd..452b7d0e19e9 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -985,6 +985,9 @@ NOSTDINC_FLAGS += -nostdinc
>> # perform bounds checking.
>> KBUILD_CFLAGS += $(call cc-option, -fstrict-flex-arrays=3)
>>
>> +# We are now in good shape to enable this option.
>
> Please remove this comment.
>
> It it fine to mention it in the commit log, but
> not in the Makefile.
Sure thing. I'll change that and add this patch to my -next tree.
>
>
>
> I hope somebody will double-check this patch in CI infrastructure.
I'll take care of that.
Thanks
--
Gustavo
>
>
>
>
>> +KBUILD_CFLAGS += $(call cc-option, -Wstringop-overflow)
>> +
>> # disable invalid "can't wrap" optimizations for signed / pointers
>> KBUILD_CFLAGS += -fno-strict-overflow
>>
>> diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
>> index 2fe6f2828d37..1527199161d7 100644
>> --- a/scripts/Makefile.extrawarn
>> +++ b/scripts/Makefile.extrawarn
>> @@ -106,7 +106,6 @@ KBUILD_CFLAGS += $(call cc-option, -Wunused-const-variable)
>> KBUILD_CFLAGS += $(call cc-option, -Wpacked-not-aligned)
>> KBUILD_CFLAGS += $(call cc-option, -Wformat-overflow)
>> KBUILD_CFLAGS += $(call cc-option, -Wformat-truncation)
>> -KBUILD_CFLAGS += $(call cc-option, -Wstringop-overflow)
>> KBUILD_CFLAGS += $(call cc-option, -Wstringop-truncation)
>>
>> KBUILD_CPPFLAGS += -Wundef
>> @@ -122,7 +121,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, restrict)
>> KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned)
>> KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
>> KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation)
>> -KBUILD_CFLAGS += $(call cc-disable-warning, stringop-overflow)
>> KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation)
>>
>> ifdef CONFIG_CC_IS_CLANG
>> --
>> 2.34.1
>>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-16 14:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-16 3:27 [PATCH][next] Makefile: Enable -Wstringop-overflow globally Gustavo A. R. Silva
2023-11-16 11:23 ` Masahiro Yamada
2023-11-16 14:18 ` Gustavo A. R. Silva
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox