Patch "scripts/Makefile.extrawarn: Do not show clang's non-kprintf warnings at W=1" has been added to the 6.13-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    scripts/Makefile.extrawarn: Do not show clang's non-kprintf warnings at W=1

to the 6.13-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     scripts-makefile.extrawarn-do-not-show-clang-s-non-k.patch
and it can be found in the queue-6.13 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 316971d56cbe1eea75699c37380853ec43a4f2d9
Author: Nathan Chancellor <nathan@xxxxxxxxxx>
Date:   Fri Jan 31 15:55:28 2025 -0700

    scripts/Makefile.extrawarn: Do not show clang's non-kprintf warnings at W=1
    
    [ Upstream commit 738fc998b639407346a9e026514f0562301462cd ]
    
    Clang's -Wformat-overflow and -Wformat-truncation have chosen to check
    '%p' unlike GCC but it does not know about the kernel's pointer
    extensions in lib/vsprintf.c, so the developers split that part of the
    warning out for the kernel to disable because there will always be false
    positives.
    
    Commit 908dd508276d ("kbuild: enable -Wformat-truncation on clang") did
    disabled these warnings but only in a block that would be called when
    W=1 was not passed, so they would appear with W=1. Move the disabling of
    the non-kprintf warnings to a block that always runs so that they are
    never seen, regardless of warning level.
    
    Fixes: 908dd508276d ("kbuild: enable -Wformat-truncation on clang")
    Reported-by: kernel test robot <lkp@xxxxxxxxx>
    Closes: https://lore.kernel.org/oe-kbuild-all/202501291646.VtwF98qd-lkp@xxxxxxxxx/
    Signed-off-by: Nathan Chancellor <nathan@xxxxxxxxxx>
    Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 04faf15ed316a..d75897559d184 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -31,6 +31,11 @@ KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) += -Wno-array-bounds
 ifdef CONFIG_CC_IS_CLANG
 # The kernel builds with '-std=gnu11' so use of GNU extensions is acceptable.
 KBUILD_CFLAGS += -Wno-gnu
+
+# Clang checks for overflow/truncation with '%p', while GCC does not:
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111219
+KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow-non-kprintf)
+KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation-non-kprintf)
 else
 
 # gcc inanely warns about local variables called 'main'
@@ -102,11 +107,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned)
 KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
 ifdef CONFIG_CC_IS_GCC
 KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation)
-else
-# Clang checks for overflow/truncation with '%p', while GCC does not:
-# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111219
-KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow-non-kprintf)
-KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation-non-kprintf)
 endif
 KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation)
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux