Re: [PATCH 3/6] [v3] kbuild: turn on -Wrestrict by default

From: Geert Uytterhoeven
Date: Tue May 28 2024 - 09:04:38 EST


Hi Arnd,

On Mon, Apr 15, 2024 at 2:22 PM Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> All known -Wrestrict warnings are addressed now, so don't disable the warning
> any more.
>
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>

Thanks for your patch, which is now commit 06bb7fc0feee32d9 ("kbuild:
turn on -Wrestrict by default") in v6.10-rc1.

With shmobile_defconfig and gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04):

kernel/kallsyms.c: In function ‘__sprint_symbol.constprop’:
kernel/kallsyms.c:492:17: warning: ‘strcpy’ source argument is the
same as destination [-Werror=restrict]
492 | strcpy(buffer, name);
| ^~~~~~~~~~~~~~~~~~~~

Reverting the commit fixes the issue.

I assume you just forgot that this depends on "[PATCH] [v5] kallsyms:
rework symbol lookup return codes"?
https://lore.kernel.org/r/20240404143424.3279752-1-arnd@xxxxxxxxxx

> --- a/scripts/Makefile.extrawarn
> +++ b/scripts/Makefile.extrawarn
> @@ -98,7 +98,6 @@ else
> # Suppress them by using -Wno... except for W=1.
> KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
> KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
> -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)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68korg

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