linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/12] kbuild: enable some -Wextra warnings by default
@ 2024-03-26 14:47 Arnd Bergmann
  2024-03-26 14:47 ` [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent Arnd Bergmann
                   ` (11 more replies)
  0 siblings, 12 replies; 36+ messages in thread
From: Arnd Bergmann @ 2024-03-26 14:47 UTC (permalink / raw)
  To: linux-kbuild, Masahiro Yamada, Nathan Chancellor
  Cc: Nicolas Schier, Arnd Bergmann, Bill Metzenthen, Thomas Gleixner,
	x86, Damien Le Moal, Jean Delvare, Harry Wentland, Jani Nikula,
	Sergey Shtylyov, Jakub Kicinski, Sudip Mukherjee, Andrew Jeffery,
	Manoj N. Kumar, Martin K. Petersen, Alexei Starovoitov,
	Steven Rostedt, Luis Chamberlain, Andrew Morton,
	Greg Kroah-Hartman, linux-kernel, linux-ide, amd-gfx, dri-devel,
	intel-gfx, nouveau, intel-xe, netdev, linux-renesas-soc,
	linux-arm-kernel, linux-scsi, bpf, linux-trace-kernel,
	linux-modules, linux-mm, llvm

From: Arnd Bergmann <arnd@arndb.de>

This is a follow-up on a couple of patch series I sent in the past,
enabling -Wextra (aside from stuff that is explicitly disabled),
-Wcast-function-pointer-strict and -Wrestrict.

I have tested these on 'defconfig' and 'allmodconfig' builds across
all architectures, as well as many 'randconfig' builds on x86, arm and
arm64. It would be nice to have all the Makefile.extrawarn changes in
v6.10, hopefully with the driver fixes going in before that through
the respective subsystem trees.

     Arnd

Arnd Bergmann (12):
  kbuild: make -Woverride-init warnings more consistent
  [v3] parport: mfc3: avoid empty-body warning
  kbuild: turn on -Wextra by default
  kbuild: remove redundant extra warning flags
  firmware: dmi-id: add a release callback function
  nouveau: fix function cast warning
  cxlflash: fix function pointer cast warnings
  x86: math-emu: fix function cast warnings
  kbuild: enable -Wcast-function-type-strict unconditionally
  sata: sx4: fix pdc20621_get_from_dimm() on 64-bit
  [v4] kallsyms: rework symbol lookup return codes
  kbuild: turn on -Wrestrict by default

 arch/x86/math-emu/fpu_etc.c                   |  9 +++--
 arch/x86/math-emu/fpu_trig.c                  |  6 ++--
 arch/x86/math-emu/reg_constant.c              |  7 +++-
 drivers/ata/sata_sx4.c                        |  6 ++--
 drivers/firmware/dmi-id.c                     |  7 +++-
 .../gpu/drm/amd/display/dc/dce110/Makefile    |  2 +-
 .../gpu/drm/amd/display/dc/dce112/Makefile    |  2 +-
 .../gpu/drm/amd/display/dc/dce120/Makefile    |  2 +-
 drivers/gpu/drm/amd/display/dc/dce60/Makefile |  2 +-
 drivers/gpu/drm/amd/display/dc/dce80/Makefile |  2 +-
 drivers/gpu/drm/i915/Makefile                 |  6 ++--
 .../drm/nouveau/nvkm/subdev/bios/shadowof.c   |  7 +++-
 drivers/gpu/drm/xe/Makefile                   |  4 +--
 drivers/net/ethernet/renesas/sh_eth.c         |  2 +-
 drivers/parport/parport_mfc3.c                |  3 +-
 drivers/pinctrl/aspeed/Makefile               |  2 +-
 drivers/scsi/cxlflash/lunmgt.c                |  4 +--
 drivers/scsi/cxlflash/main.c                  | 14 ++++----
 drivers/scsi/cxlflash/superpipe.c             | 34 +++++++++----------
 drivers/scsi/cxlflash/superpipe.h             | 11 +++---
 drivers/scsi/cxlflash/vlun.c                  |  7 ++--
 fs/proc/Makefile                              |  2 +-
 include/linux/filter.h                        | 14 ++++----
 include/linux/ftrace.h                        |  6 ++--
 include/linux/module.h                        | 14 ++++----
 kernel/bpf/Makefile                           |  2 +-
 kernel/bpf/core.c                             |  7 ++--
 kernel/kallsyms.c                             | 23 +++++++------
 kernel/module/kallsyms.c                      | 26 +++++++-------
 kernel/trace/ftrace.c                         | 13 +++----
 mm/Makefile                                   |  3 +-
 scripts/Makefile.extrawarn                    | 33 ++++--------------
 32 files changed, 134 insertions(+), 148 deletions(-)

-- 
2.39.2

Cc: Bill Metzenthen <billm@melbpc.org.au>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: x86@kernel.org
Cc: Damien Le Moal <dlemoal@kernel.org>
Cc: Jean Delvare <jdelvare@suse.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Sergey Shtylyov <s.shtylyov@omp.ru>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: Andrew Jeffery <andrew@codeconstruct.com.au>
Cc: "Manoj N. Kumar" <manoj@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nicolas Schier <nicolas@fjasle.eu>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: linux-kernel@vger.kernel.org
Cc: linux-ide@vger.kernel.org
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Cc: nouveau@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org
Cc: netdev@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-scsi@vger.kernel.org
Cc: bpf@vger.kernel.org
Cc: linux-trace-kernel@vger.kernel.org
Cc: linux-modules@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: linux-kbuild@vger.kernel.org
Cc: llvm@lists.linux.dev

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent
  2024-03-26 14:47 [PATCH 00/12] kbuild: enable some -Wextra warnings by default Arnd Bergmann
@ 2024-03-26 14:47 ` Arnd Bergmann
  2024-03-26 16:04   ` Hamza Mahfooz
                     ` (3 more replies)
  2024-03-26 14:51 ` [PATCH 02/12] [v3] parport: mfc3: avoid empty-body warning Arnd Bergmann
                   ` (10 subsequent siblings)
  11 siblings, 4 replies; 36+ messages in thread
From: Arnd Bergmann @ 2024-03-26 14:47 UTC (permalink / raw)
  To: linux-kbuild, Masahiro Yamada, Harry Wentland, Alex Deucher,
	Christian König, Jani Nikula, Lucas De Marchi, Oded Gabbay,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Jakub Kicinski, Paolo Abeni, Andrew Jeffery, Linus Walleij,
	Joel Stanley, Alexei Starovoitov, Daniel Borkmann, Andrew Morton,
	Nathan Chancellor
  Cc: Nicolas Schier, Arnd Bergmann, dri-devel, linux-kernel, netdev,
	linux-mm, llvm

From: Arnd Bergmann <arnd@arndb.de>

The -Woverride-init warn about code that may be intentional or not,
but the inintentional ones tend to be real bugs, so there is a bit of
disagreement on whether this warning option should be enabled by default
and we have multiple settings in scripts/Makefile.extrawarn as well as
individual subsystems.

Older versions of clang only supported -Wno-initializer-overrides with
the same meaning as gcc's -Woverride-init, though all supported versions
now work with both. Because of this difference, an earlier cleanup of
mine accidentally turned the clang warning off for W=1 builds and only
left it on for W=2, while it's still enabled for gcc with W=1.

There is also one driver that only turns the warning off for newer
versions of gcc but not other compilers, and some but not all the
Makefiles still use a cc-disable-warning conditional that is no
longer needed with supported compilers here.

Address all of the above by removing the special cases for clang
and always turning the warning off unconditionally where it got
in the way, using the syntax that is supported by both compilers.

Fixes: 2cd3271b7a31 ("kbuild: avoid duplicate warning options")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/amd/display/dc/dce110/Makefile |  2 +-
 drivers/gpu/drm/amd/display/dc/dce112/Makefile |  2 +-
 drivers/gpu/drm/amd/display/dc/dce120/Makefile |  2 +-
 drivers/gpu/drm/amd/display/dc/dce60/Makefile  |  2 +-
 drivers/gpu/drm/amd/display/dc/dce80/Makefile  |  2 +-
 drivers/gpu/drm/i915/Makefile                  |  6 +++---
 drivers/gpu/drm/xe/Makefile                    |  4 ++--
 drivers/net/ethernet/renesas/sh_eth.c          |  2 +-
 drivers/pinctrl/aspeed/Makefile                |  2 +-
 fs/proc/Makefile                               |  2 +-
 kernel/bpf/Makefile                            |  2 +-
 mm/Makefile                                    |  3 +--
 scripts/Makefile.extrawarn                     | 10 +++-------
 13 files changed, 18 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dce110/Makefile b/drivers/gpu/drm/amd/display/dc/dce110/Makefile
index f0777d61c2cb..c307f040e48f 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dce110/Makefile
@@ -23,7 +23,7 @@
 # Makefile for the 'controller' sub-component of DAL.
 # It provides the control and status of HW CRTC block.
 
-CFLAGS_$(AMDDALPATH)/dc/dce110/dce110_resource.o = $(call cc-disable-warning, override-init)
+CFLAGS_$(AMDDALPATH)/dc/dce110/dce110_resource.o = -Wno-override-init
 
 DCE110 = dce110_timing_generator.o \
 dce110_compressor.o dce110_opp_regamma_v.o \
diff --git a/drivers/gpu/drm/amd/display/dc/dce112/Makefile b/drivers/gpu/drm/amd/display/dc/dce112/Makefile
index 7e92effec894..683866797709 100644
--- a/drivers/gpu/drm/amd/display/dc/dce112/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dce112/Makefile
@@ -23,7 +23,7 @@
 # Makefile for the 'controller' sub-component of DAL.
 # It provides the control and status of HW CRTC block.
 
-CFLAGS_$(AMDDALPATH)/dc/dce112/dce112_resource.o = $(call cc-disable-warning, override-init)
+CFLAGS_$(AMDDALPATH)/dc/dce112/dce112_resource.o = -Wno-override-init
 
 DCE112 = dce112_compressor.o
 
diff --git a/drivers/gpu/drm/amd/display/dc/dce120/Makefile b/drivers/gpu/drm/amd/display/dc/dce120/Makefile
index 1e3ef68a452a..8f508e662748 100644
--- a/drivers/gpu/drm/amd/display/dc/dce120/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dce120/Makefile
@@ -24,7 +24,7 @@
 # It provides the control and status of HW CRTC block.
 
 
-CFLAGS_$(AMDDALPATH)/dc/dce120/dce120_resource.o = $(call cc-disable-warning, override-init)
+CFLAGS_$(AMDDALPATH)/dc/dce120/dce120_resource.o = -Wno-override-init
 
 DCE120 = dce120_timing_generator.o
 
diff --git a/drivers/gpu/drm/amd/display/dc/dce60/Makefile b/drivers/gpu/drm/amd/display/dc/dce60/Makefile
index fee331accc0e..eede83ad91fa 100644
--- a/drivers/gpu/drm/amd/display/dc/dce60/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dce60/Makefile
@@ -23,7 +23,7 @@
 # Makefile for the 'controller' sub-component of DAL.
 # It provides the control and status of HW CRTC block.
 
-CFLAGS_$(AMDDALPATH)/dc/dce60/dce60_resource.o = $(call cc-disable-warning, override-init)
+CFLAGS_$(AMDDALPATH)/dc/dce60/dce60_resource.o = -Wno-override-init
 
 DCE60 = dce60_timing_generator.o dce60_hw_sequencer.o \
 	dce60_resource.o
diff --git a/drivers/gpu/drm/amd/display/dc/dce80/Makefile b/drivers/gpu/drm/amd/display/dc/dce80/Makefile
index 7eefffbdc925..fba189d26652 100644
--- a/drivers/gpu/drm/amd/display/dc/dce80/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dce80/Makefile
@@ -23,7 +23,7 @@
 # Makefile for the 'controller' sub-component of DAL.
 # It provides the control and status of HW CRTC block.
 
-CFLAGS_$(AMDDALPATH)/dc/dce80/dce80_resource.o = $(call cc-disable-warning, override-init)
+CFLAGS_$(AMDDALPATH)/dc/dce80/dce80_resource.o = -Wno-override-init
 
 DCE80 = dce80_timing_generator.o
 
diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 3ef6ed41e62b..4c2f85632391 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -33,9 +33,9 @@ endif
 subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror
 
 # Fine grained warnings disable
-CFLAGS_i915_pci.o = $(call cc-disable-warning, override-init)
-CFLAGS_display/intel_display_device.o = $(call cc-disable-warning, override-init)
-CFLAGS_display/intel_fbdev.o = $(call cc-disable-warning, override-init)
+CFLAGS_i915_pci.o = -Wno-override-init
+CFLAGS_display/intel_display_device.o = -Wno-override-init
+CFLAGS_display/intel_fbdev.o = -Wno-override-init
 
 # Support compiling the display code separately for both i915 and xe
 # drivers. Define I915 when building i915.
diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile
index 5a428ca00f10..c29a850859ad 100644
--- a/drivers/gpu/drm/xe/Makefile
+++ b/drivers/gpu/drm/xe/Makefile
@@ -172,8 +172,8 @@ subdir-ccflags-$(CONFIG_DRM_XE_DISPLAY) += \
 	-Ddrm_i915_gem_object=xe_bo \
 	-Ddrm_i915_private=xe_device
 
-CFLAGS_i915-display/intel_fbdev.o = $(call cc-disable-warning, override-init)
-CFLAGS_i915-display/intel_display_device.o = $(call cc-disable-warning, override-init)
+CFLAGS_i915-display/intel_fbdev.o = -Wno-override-init
+CFLAGS_i915-display/intel_display_device.o = -Wno-override-init
 
 # Rule to build SOC code shared with i915
 $(obj)/i915-soc/%.o: $(srctree)/drivers/gpu/drm/i915/soc/%.c FORCE
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 475e1e8c1d35..0786eb0da391 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -50,7 +50,7 @@
  * the macros available to do this only define GCC 8.
  */
 __diag_push();
-__diag_ignore(GCC, 8, "-Woverride-init",
+__diag_ignore_all("-Woverride-init",
 	      "logic to initialize all and then override some is OK");
 static const u16 sh_eth_offset_gigabit[SH_ETH_MAX_REGISTER_OFFSET] = {
 	SH_ETH_OFFSET_DEFAULTS,
diff --git a/drivers/pinctrl/aspeed/Makefile b/drivers/pinctrl/aspeed/Makefile
index 489ea1778353..db2a7600ae2b 100644
--- a/drivers/pinctrl/aspeed/Makefile
+++ b/drivers/pinctrl/aspeed/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 # Aspeed pinctrl support
 
-ccflags-y += $(call cc-option,-Woverride-init)
+ccflags-y += -Woverride-init
 obj-$(CONFIG_PINCTRL_ASPEED)	+= pinctrl-aspeed.o pinmux-aspeed.o
 obj-$(CONFIG_PINCTRL_ASPEED_G4)	+= pinctrl-aspeed-g4.o
 obj-$(CONFIG_PINCTRL_ASPEED_G5)	+= pinctrl-aspeed-g5.o
diff --git a/fs/proc/Makefile b/fs/proc/Makefile
index bd08616ed8ba..7b4db9c56e6a 100644
--- a/fs/proc/Makefile
+++ b/fs/proc/Makefile
@@ -5,7 +5,7 @@
 
 obj-y   += proc.o
 
-CFLAGS_task_mmu.o	+= $(call cc-option,-Wno-override-init,)
+CFLAGS_task_mmu.o	+= -Wno-override-init
 proc-y			:= nommu.o task_nommu.o
 proc-$(CONFIG_MMU)	:= task_mmu.o
 
diff --git a/kernel/bpf/Makefile b/kernel/bpf/Makefile
index 368c5d86b5b7..e497011261b8 100644
--- a/kernel/bpf/Makefile
+++ b/kernel/bpf/Makefile
@@ -4,7 +4,7 @@ ifneq ($(CONFIG_BPF_JIT_ALWAYS_ON),y)
 # ___bpf_prog_run() needs GCSE disabled on x86; see 3193c0836f203 for details
 cflags-nogcse-$(CONFIG_X86)$(CONFIG_CC_IS_GCC) := -fno-gcse
 endif
-CFLAGS_core.o += $(call cc-disable-warning, override-init) $(cflags-nogcse-yy)
+CFLAGS_core.o += -Wno-override-init $(cflags-nogcse-yy)
 
 obj-$(CONFIG_BPF_SYSCALL) += syscall.o verifier.o inode.o helpers.o tnum.o log.o token.o
 obj-$(CONFIG_BPF_SYSCALL) += bpf_iter.o map_iter.o task_iter.o prog_iter.o link_iter.o
diff --git a/mm/Makefile b/mm/Makefile
index e4b5b75aaec9..4abb40b911ec 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -29,8 +29,7 @@ KCOV_INSTRUMENT_mmzone.o := n
 KCOV_INSTRUMENT_vmstat.o := n
 KCOV_INSTRUMENT_failslab.o := n
 
-CFLAGS_init-mm.o += $(call cc-disable-warning, override-init)
-CFLAGS_init-mm.o += $(call cc-disable-warning, initializer-overrides)
+CFLAGS_init-mm.o += -Wno-override-init
 
 mmu-y			:= nommu.o
 mmu-$(CONFIG_MMU)	:= highmem.o memory.o mincore.o \
diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 3ce5d503a6da..c5af566e911a 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -114,6 +114,8 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
 KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation)
 KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation)
 
+KBUILD_CFLAGS += -Wno-override-init # alias for -Wno-initializer-overrides in clang
+
 ifdef CONFIG_CC_IS_CLANG
 # Clang before clang-16 would warn on default argument promotions.
 ifneq ($(call clang-min-version, 160000),y)
@@ -151,10 +153,6 @@ KBUILD_CFLAGS += -Wtype-limits
 KBUILD_CFLAGS += $(call cc-option, -Wmaybe-uninitialized)
 KBUILD_CFLAGS += $(call cc-option, -Wunused-macros)
 
-ifdef CONFIG_CC_IS_CLANG
-KBUILD_CFLAGS += -Winitializer-overrides
-endif
-
 KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN2
 
 else
@@ -164,9 +162,7 @@ KBUILD_CFLAGS += -Wno-missing-field-initializers
 KBUILD_CFLAGS += -Wno-type-limits
 KBUILD_CFLAGS += -Wno-shift-negative-value
 
-ifdef CONFIG_CC_IS_CLANG
-KBUILD_CFLAGS += -Wno-initializer-overrides
-else
+ifdef CONFIG_CC_IS_GCC
 KBUILD_CFLAGS += -Wno-maybe-uninitialized
 endif
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 02/12] [v3] parport: mfc3: avoid empty-body warning
  2024-03-26 14:47 [PATCH 00/12] kbuild: enable some -Wextra warnings by default Arnd Bergmann
  2024-03-26 14:47 ` [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent Arnd Bergmann
@ 2024-03-26 14:51 ` Arnd Bergmann
  2024-03-26 14:51 ` [PATCH 03/12] kbuild: turn on -Wextra by default Arnd Bergmann
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2024-03-26 14:51 UTC (permalink / raw)
  To: linux-kbuild, Masahiro Yamada, Sudip Mukherjee
  Cc: Nicolas Schier, Nathan Chancellor, Arnd Bergmann, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

on m68k builds, the mfc3 driver causes a warning about an empty if() block:

drivers/parport/parport_mfc3.c: In function 'control_pc_to_mfc3':
drivers/parport/parport_mfc3.c:106:37: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]

Remove it in favor of a simpler comment.

Acked-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Link: https://lore.kernel.org/lkml/20230727122448.2479942-1-arnd@kernel.org/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v3: no changes, resending
v2: fix typo
---
 drivers/parport/parport_mfc3.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/parport/parport_mfc3.c b/drivers/parport/parport_mfc3.c
index f4d0da741e85..bb1817218d7b 100644
--- a/drivers/parport/parport_mfc3.c
+++ b/drivers/parport/parport_mfc3.c
@@ -102,8 +102,7 @@ static unsigned char control_pc_to_mfc3(unsigned char control)
 		ret |= 128;
 	if (control & PARPORT_CONTROL_AUTOFD) /* AUTOLF */
 		ret &= ~64;
-	if (control & PARPORT_CONTROL_STROBE) /* Strobe */
-		/* Handled directly by hardware */;
+	/* PARPORT_CONTROL_STROBE handled directly by hardware */
 	return ret;
 }
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 03/12] kbuild: turn on -Wextra by default
  2024-03-26 14:47 [PATCH 00/12] kbuild: enable some -Wextra warnings by default Arnd Bergmann
  2024-03-26 14:47 ` [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent Arnd Bergmann
  2024-03-26 14:51 ` [PATCH 02/12] [v3] parport: mfc3: avoid empty-body warning Arnd Bergmann
@ 2024-03-26 14:51 ` Arnd Bergmann
  2024-03-26 14:51 ` [PATCH 04/12] kbuild: remove redundant extra warning flags Arnd Bergmann
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2024-03-26 14:51 UTC (permalink / raw)
  To: linux-kbuild, Masahiro Yamada
  Cc: Nicolas Schier, Nathan Chancellor, Arnd Bergmann, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

The -Wextra option controls a number of different warnings that differ
slightly by compiler version. Some are useful in general, others are
better left at W=1 or higher. Based on earlier work, the ones that
should be disabled by default are left for the higher warning levels
already, and a lot of the useful ones have no remaining output when
enabled.

Move the -Wextra option up into the set of default-enabled warnings
and just rely on the individual ones getting disabled as needed.

The -Wunused warning was always grouped with this, so turn it on
by default as well, except for the -Wunused-parameter warning that
really has no value at all for the kernel since many interfaces
have intentionally unused arguments.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 scripts/Makefile.extrawarn | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index c5af566e911a..c247552c192c 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -82,12 +82,14 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init)
 # Warn if there is an enum types mismatch
 KBUILD_CFLAGS += $(call cc-option,-Wenum-conversion)
 
+KBUILD_CFLAGS += -Wextra
+KBUILD_CFLAGS += -Wunused
+
 #
 # W=1 - warnings which may be relevant and do not occur too often
 #
 ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),)
 
-KBUILD_CFLAGS += -Wextra -Wunused -Wno-unused-parameter
 KBUILD_CFLAGS += $(call cc-option, -Wrestrict)
 KBUILD_CFLAGS += -Wmissing-format-attribute
 KBUILD_CFLAGS += -Wold-style-definition
@@ -190,6 +192,7 @@ else
 
 # The following turn off the warnings enabled by -Wextra
 KBUILD_CFLAGS += -Wno-sign-compare
+KBUILD_CFLAGS += -Wno-unused-parameter
 
 endif
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 04/12] kbuild: remove redundant extra warning flags
  2024-03-26 14:47 [PATCH 00/12] kbuild: enable some -Wextra warnings by default Arnd Bergmann
                   ` (2 preceding siblings ...)
  2024-03-26 14:51 ` [PATCH 03/12] kbuild: turn on -Wextra by default Arnd Bergmann
@ 2024-03-26 14:51 ` Arnd Bergmann
  2024-03-26 14:51 ` [PATCH 05/12] firmware: dmi-id: add a release callback function Arnd Bergmann
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2024-03-26 14:51 UTC (permalink / raw)
  To: linux-kbuild, Masahiro Yamada
  Cc: Nicolas Schier, Nathan Chancellor, Arnd Bergmann, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

There is no point in turning individual options off and then on again,
or vice versa, as the last one always wins. Now that -Wextra always
gets passed first, remove all the redundant lines about warnings
that are implied by either -Wall or -Wextra, and keep only the last
one that disables it in some configurations.

This should not have any effect but keep the Makefile more readable
and the command line shorter.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 scripts/Makefile.extrawarn | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index c247552c192c..17b00d85f6aa 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -37,11 +37,6 @@ else
 KBUILD_CFLAGS += -Wno-main
 endif
 
-# These warnings generated too much noise in a regular build.
-# Use make W=1 to enable them (see scripts/Makefile.extrawarn)
-KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
-KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
-
 # These result in bogus false positives
 KBUILD_CFLAGS += $(call cc-disable-warning, dangling-pointer)
 
@@ -90,16 +85,8 @@ KBUILD_CFLAGS += -Wunused
 #
 ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),)
 
-KBUILD_CFLAGS += $(call cc-option, -Wrestrict)
 KBUILD_CFLAGS += -Wmissing-format-attribute
-KBUILD_CFLAGS += -Wold-style-definition
 KBUILD_CFLAGS += -Wmissing-include-dirs
-KBUILD_CFLAGS += $(call cc-option, -Wunused-but-set-variable)
-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-truncation)
 
 KBUILD_CPPFLAGS += -Wundef
 KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN1
@@ -150,9 +137,6 @@ ifneq ($(findstring 2, $(KBUILD_EXTRA_WARN)),)
 KBUILD_CFLAGS += -Wdisabled-optimization
 KBUILD_CFLAGS += -Wshadow
 KBUILD_CFLAGS += $(call cc-option, -Wlogical-op)
-KBUILD_CFLAGS += -Wmissing-field-initializers
-KBUILD_CFLAGS += -Wtype-limits
-KBUILD_CFLAGS += $(call cc-option, -Wmaybe-uninitialized)
 KBUILD_CFLAGS += $(call cc-option, -Wunused-macros)
 
 KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN2
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 05/12] firmware: dmi-id: add a release callback function
  2024-03-26 14:47 [PATCH 00/12] kbuild: enable some -Wextra warnings by default Arnd Bergmann
                   ` (3 preceding siblings ...)
  2024-03-26 14:51 ` [PATCH 04/12] kbuild: remove redundant extra warning flags Arnd Bergmann
@ 2024-03-26 14:51 ` Arnd Bergmann
  2024-03-29 12:49   ` Jean Delvare
  2024-03-26 14:51 ` [PATCH 06/12] nouveau: fix function cast warning Arnd Bergmann
                   ` (6 subsequent siblings)
  11 siblings, 1 reply; 36+ messages in thread
From: Arnd Bergmann @ 2024-03-26 14:51 UTC (permalink / raw)
  To: linux-kbuild, Masahiro Yamada, Jean Delvare, Nathan Chancellor,
	Greg Kroah-Hartman
  Cc: Nicolas Schier, Arnd Bergmann, Nick Desaulniers, Bill Wendling,
	Justin Stitt, linux-kernel, llvm

From: Arnd Bergmann <arnd@arndb.de>

dmi_class uses kfree() as the .release function, but that now causes
a warning with clang-16 as it violates control flow integrity (KCFI)
rules:

drivers/firmware/dmi-id.c:174:17: error: cast from 'void (*)(const void *)' to 'void (*)(struct device *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  174 |         .dev_release = (void(*)(struct device *)) kfree,

Add an explicit function to call kfree() instead.

Fixes: 4f5c791a850e ("DMI-based module autoloading")
Link: https://lore.kernel.org/lkml/20240213100238.456912-1-arnd@kernel.org/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
I sent this before but got no comments for it
---
 drivers/firmware/dmi-id.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/dmi-id.c b/drivers/firmware/dmi-id.c
index 5f3a3e913d28..d19c78a78ae3 100644
--- a/drivers/firmware/dmi-id.c
+++ b/drivers/firmware/dmi-id.c
@@ -169,9 +169,14 @@ static int dmi_dev_uevent(const struct device *dev, struct kobj_uevent_env *env)
 	return 0;
 }
 
+static void dmi_dev_release(struct device *dev)
+{
+	kfree(dev);
+}
+
 static struct class dmi_class = {
 	.name = "dmi",
-	.dev_release = (void(*)(struct device *)) kfree,
+	.dev_release = dmi_dev_release,
 	.dev_uevent = dmi_dev_uevent,
 };
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 06/12] nouveau: fix function cast warning
  2024-03-26 14:47 [PATCH 00/12] kbuild: enable some -Wextra warnings by default Arnd Bergmann
                   ` (4 preceding siblings ...)
  2024-03-26 14:51 ` [PATCH 05/12] firmware: dmi-id: add a release callback function Arnd Bergmann
@ 2024-03-26 14:51 ` Arnd Bergmann
  2024-03-26 15:20   ` Timur Tabi
  2024-03-26 14:51 ` [PATCH 07/12] cxlflash: fix function pointer cast warnings Arnd Bergmann
                   ` (5 subsequent siblings)
  11 siblings, 1 reply; 36+ messages in thread
From: Arnd Bergmann @ 2024-03-26 14:51 UTC (permalink / raw)
  To: linux-kbuild, Masahiro Yamada, Karol Herbst, Lyude Paul,
	Danilo Krummrich, David Airlie, Daniel Vetter, Nathan Chancellor,
	Ben Skeggs
  Cc: Nicolas Schier, Arnd Bergmann, Nick Desaulniers, Bill Wendling,
	Justin Stitt, dri-devel, nouveau, linux-kernel, llvm

From: Arnd Bergmann <arnd@arndb.de>

Calling a function through an incompatible pointer type causes breaks
kcfi, so clang warns about the assignment:

drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c:73:10: error: cast from 'void (*)(const void *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
   73 |         .fini = (void(*)(void *))kfree,

Avoid this with a trivial wrapper.

Fixes: c39f472e9f14 ("drm/nouveau: remove symlinks, move core/ to nvkm/ (no code changes)")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c
index 4bf486b57101..0dbcc23305f3 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadowof.c
@@ -66,11 +66,16 @@ of_init(struct nvkm_bios *bios, const char *name)
 	return ERR_PTR(-EINVAL);
 }
 
+static void of_fini(void *p)
+{
+	return kfree(p);
+}
+
 const struct nvbios_source
 nvbios_of = {
 	.name = "OpenFirmware",
 	.init = of_init,
-	.fini = (void(*)(void *))kfree,
+	.fini = of_fini,
 	.read = of_read,
 	.size = of_size,
 	.rw = false,
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 07/12] cxlflash: fix function pointer cast warnings
  2024-03-26 14:47 [PATCH 00/12] kbuild: enable some -Wextra warnings by default Arnd Bergmann
                   ` (5 preceding siblings ...)
  2024-03-26 14:51 ` [PATCH 06/12] nouveau: fix function cast warning Arnd Bergmann
@ 2024-03-26 14:51 ` Arnd Bergmann
  2024-03-26 14:51 ` [PATCH 08/12] x86: math-emu: fix function " Arnd Bergmann
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2024-03-26 14:51 UTC (permalink / raw)
  To: linux-kbuild, Masahiro Yamada, Manoj N. Kumar, Matthew R. Ochs,
	Uma Krishnan, James E.J. Bottomley, Martin K. Petersen,
	Nathan Chancellor
  Cc: Nicolas Schier, Arnd Bergmann, Nick Desaulniers, Bill Wendling,
	Justin Stitt, Geert Uytterhoeven, linux-scsi, linux-kernel, llvm

From: Arnd Bergmann <arnd@arndb.de>

Calling a function through an incompatible pointer type causes breaks
kcfi, so clang warns about the assignments:

drivers/scsi/cxlflash/main.c:3498:3: error: cast from 'int (*)(struct cxlflash_cfg *, struct ht_cxlflash_lun_provision *)' to 'hioctl' (aka 'int (*)(struct cxlflash_cfg *, void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
 3498 |                 (hioctl)cxlflash_lun_provision },
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/cxlflash/main.c:3500:3: error: cast from 'int (*)(struct cxlflash_cfg *, struct ht_cxlflash_afu_debug *)' to 'hioctl' (aka 'int (*)(struct cxlflash_cfg *, void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
 3500 |                 (hioctl)cxlflash_afu_debug },
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~

Address these by changing the functions to have the correct type
and replace the function pointer cast with a cast of its argument.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/scsi/cxlflash/lunmgt.c    |  4 ++--
 drivers/scsi/cxlflash/main.c      | 14 ++++++-------
 drivers/scsi/cxlflash/superpipe.c | 34 +++++++++++++++----------------
 drivers/scsi/cxlflash/superpipe.h | 11 ++++------
 drivers/scsi/cxlflash/vlun.c      |  7 +++----
 5 files changed, 31 insertions(+), 39 deletions(-)

diff --git a/drivers/scsi/cxlflash/lunmgt.c b/drivers/scsi/cxlflash/lunmgt.c
index e0e15b44a2e6..7d5e9b49eb90 100644
--- a/drivers/scsi/cxlflash/lunmgt.c
+++ b/drivers/scsi/cxlflash/lunmgt.c
@@ -224,9 +224,9 @@ void cxlflash_term_global_luns(void)
  *
  * Return: 0 on success, -errno on failure
  */
-int cxlflash_manage_lun(struct scsi_device *sdev,
-			struct dk_cxlflash_manage_lun *manage)
+int cxlflash_manage_lun(struct scsi_device *sdev, void *arg)
 {
+	struct dk_cxlflash_manage_lun *manage = arg;
 	struct cxlflash_cfg *cfg = shost_priv(sdev->host);
 	struct device *dev = &cfg->dev->dev;
 	struct llun_info *lli = NULL;
diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c
index debd36974119..2ad157e8b1c2 100644
--- a/drivers/scsi/cxlflash/main.c
+++ b/drivers/scsi/cxlflash/main.c
@@ -3279,9 +3279,9 @@ static char *decode_hioctl(unsigned int cmd)
  *
  * Return: 0 on success, -errno on failure
  */
-static int cxlflash_lun_provision(struct cxlflash_cfg *cfg,
-				  struct ht_cxlflash_lun_provision *lunprov)
+static int cxlflash_lun_provision(struct cxlflash_cfg *cfg, void *arg)
 {
+	struct ht_cxlflash_lun_provision *lunprov = arg;
 	struct afu *afu = cfg->afu;
 	struct device *dev = &cfg->dev->dev;
 	struct sisl_ioarcb rcb;
@@ -3373,9 +3373,9 @@ static int cxlflash_lun_provision(struct cxlflash_cfg *cfg,
  *
  * Return: 0 on success, -errno on failure
  */
-static int cxlflash_afu_debug(struct cxlflash_cfg *cfg,
-			      struct ht_cxlflash_afu_debug *afu_dbg)
+static int cxlflash_afu_debug(struct cxlflash_cfg *cfg, void *arg)
 {
+	struct ht_cxlflash_afu_debug *afu_dbg = arg;
 	struct afu *afu = cfg->afu;
 	struct device *dev = &cfg->dev->dev;
 	struct sisl_ioarcb rcb;
@@ -3489,10 +3489,8 @@ static long cxlflash_chr_ioctl(struct file *file, unsigned int cmd,
 		size_t size;
 		hioctl ioctl;
 	} ioctl_tbl[] = {	/* NOTE: order matters here */
-	{ sizeof(struct ht_cxlflash_lun_provision),
-		(hioctl)cxlflash_lun_provision },
-	{ sizeof(struct ht_cxlflash_afu_debug),
-		(hioctl)cxlflash_afu_debug },
+	{ sizeof(struct ht_cxlflash_lun_provision), cxlflash_lun_provision },
+	{ sizeof(struct ht_cxlflash_afu_debug), cxlflash_afu_debug },
 	};
 
 	/* Hold read semaphore so we can drain if needed */
diff --git a/drivers/scsi/cxlflash/superpipe.c b/drivers/scsi/cxlflash/superpipe.c
index e1b55b03e812..afbc8619573d 100644
--- a/drivers/scsi/cxlflash/superpipe.c
+++ b/drivers/scsi/cxlflash/superpipe.c
@@ -729,8 +729,7 @@ int _cxlflash_disk_release(struct scsi_device *sdev,
 	return rc;
 }
 
-int cxlflash_disk_release(struct scsi_device *sdev,
-			  struct dk_cxlflash_release *release)
+int cxlflash_disk_release(struct scsi_device *sdev, void *release)
 {
 	return _cxlflash_disk_release(sdev, NULL, release);
 }
@@ -955,8 +954,7 @@ static int _cxlflash_disk_detach(struct scsi_device *sdev,
 	return rc;
 }
 
-static int cxlflash_disk_detach(struct scsi_device *sdev,
-				struct dk_cxlflash_detach *detach)
+static int cxlflash_disk_detach(struct scsi_device *sdev, void *detach)
 {
 	return _cxlflash_disk_detach(sdev, NULL, detach);
 }
@@ -1314,9 +1312,9 @@ int check_state(struct cxlflash_cfg *cfg)
  *
  * Return: 0 on success, -errno on failure
  */
-static int cxlflash_disk_attach(struct scsi_device *sdev,
-				struct dk_cxlflash_attach *attach)
+static int cxlflash_disk_attach(struct scsi_device *sdev, void *arg)
 {
+	struct dk_cxlflash_attach *attach = arg;
 	struct cxlflash_cfg *cfg = shost_priv(sdev->host);
 	struct device *dev = &cfg->dev->dev;
 	struct afu *afu = cfg->afu;
@@ -1648,9 +1646,9 @@ static int recover_context(struct cxlflash_cfg *cfg,
  *
  * Return: 0 on success, -errno on failure
  */
-static int cxlflash_afu_recover(struct scsi_device *sdev,
-				struct dk_cxlflash_recover_afu *recover)
+static int cxlflash_afu_recover(struct scsi_device *sdev, void *arg)
 {
+	struct dk_cxlflash_recover_afu *recover = arg;
 	struct cxlflash_cfg *cfg = shost_priv(sdev->host);
 	struct device *dev = &cfg->dev->dev;
 	struct llun_info *lli = sdev->hostdata;
@@ -1833,9 +1831,9 @@ static int process_sense(struct scsi_device *sdev,
  *
  * Return: 0 on success, -errno on failure
  */
-static int cxlflash_disk_verify(struct scsi_device *sdev,
-				struct dk_cxlflash_verify *verify)
+static int cxlflash_disk_verify(struct scsi_device *sdev, void *arg)
 {
+	struct dk_cxlflash_verify *verify = arg;
 	int rc = 0;
 	struct ctx_info *ctxi = NULL;
 	struct cxlflash_cfg *cfg = shost_priv(sdev->host);
@@ -2111,16 +2109,16 @@ int cxlflash_ioctl(struct scsi_device *sdev, unsigned int cmd, void __user *arg)
 		size_t size;
 		sioctl ioctl;
 	} ioctl_tbl[] = {	/* NOTE: order matters here */
-	{sizeof(struct dk_cxlflash_attach), (sioctl)cxlflash_disk_attach},
+	{sizeof(struct dk_cxlflash_attach), cxlflash_disk_attach},
 	{sizeof(struct dk_cxlflash_udirect), cxlflash_disk_direct_open},
-	{sizeof(struct dk_cxlflash_release), (sioctl)cxlflash_disk_release},
-	{sizeof(struct dk_cxlflash_detach), (sioctl)cxlflash_disk_detach},
-	{sizeof(struct dk_cxlflash_verify), (sioctl)cxlflash_disk_verify},
-	{sizeof(struct dk_cxlflash_recover_afu), (sioctl)cxlflash_afu_recover},
-	{sizeof(struct dk_cxlflash_manage_lun), (sioctl)cxlflash_manage_lun},
+	{sizeof(struct dk_cxlflash_release), cxlflash_disk_release},
+	{sizeof(struct dk_cxlflash_detach), cxlflash_disk_detach},
+	{sizeof(struct dk_cxlflash_verify), cxlflash_disk_verify},
+	{sizeof(struct dk_cxlflash_recover_afu), cxlflash_afu_recover},
+	{sizeof(struct dk_cxlflash_manage_lun), cxlflash_manage_lun},
 	{sizeof(struct dk_cxlflash_uvirtual), cxlflash_disk_virtual_open},
-	{sizeof(struct dk_cxlflash_resize), (sioctl)cxlflash_vlun_resize},
-	{sizeof(struct dk_cxlflash_clone), (sioctl)cxlflash_disk_clone},
+	{sizeof(struct dk_cxlflash_resize), cxlflash_vlun_resize},
+	{sizeof(struct dk_cxlflash_clone), cxlflash_disk_clone},
 	};
 
 	/* Hold read semaphore so we can drain if needed */
diff --git a/drivers/scsi/cxlflash/superpipe.h b/drivers/scsi/cxlflash/superpipe.h
index 0e3b45964066..fe8c975d13d7 100644
--- a/drivers/scsi/cxlflash/superpipe.h
+++ b/drivers/scsi/cxlflash/superpipe.h
@@ -114,18 +114,16 @@ struct cxlflash_global {
 	struct page *err_page; /* One page of all 0xF for error notification */
 };
 
-int cxlflash_vlun_resize(struct scsi_device *sdev,
-			 struct dk_cxlflash_resize *resize);
+int cxlflash_vlun_resize(struct scsi_device *sdev, void *resize);
 int _cxlflash_vlun_resize(struct scsi_device *sdev, struct ctx_info *ctxi,
 			  struct dk_cxlflash_resize *resize);
 
 int cxlflash_disk_release(struct scsi_device *sdev,
-			  struct dk_cxlflash_release *release);
+			  void *release);
 int _cxlflash_disk_release(struct scsi_device *sdev, struct ctx_info *ctxi,
 			   struct dk_cxlflash_release *release);
 
-int cxlflash_disk_clone(struct scsi_device *sdev,
-			struct dk_cxlflash_clone *clone);
+int cxlflash_disk_clone(struct scsi_device *sdev, void *arg);
 
 int cxlflash_disk_virtual_open(struct scsi_device *sdev, void *arg);
 
@@ -145,8 +143,7 @@ void rhte_checkin(struct ctx_info *ctxi, struct sisl_rht_entry *rhte);
 
 void cxlflash_ba_terminate(struct ba_lun *ba_lun);
 
-int cxlflash_manage_lun(struct scsi_device *sdev,
-			struct dk_cxlflash_manage_lun *manage);
+int cxlflash_manage_lun(struct scsi_device *sdev, void *manage);
 
 int check_state(struct cxlflash_cfg *cfg);
 
diff --git a/drivers/scsi/cxlflash/vlun.c b/drivers/scsi/cxlflash/vlun.c
index cbd5a648a131..d9a89fd27645 100644
--- a/drivers/scsi/cxlflash/vlun.c
+++ b/drivers/scsi/cxlflash/vlun.c
@@ -819,8 +819,7 @@ int _cxlflash_vlun_resize(struct scsi_device *sdev,
 	return rc;
 }
 
-int cxlflash_vlun_resize(struct scsi_device *sdev,
-			 struct dk_cxlflash_resize *resize)
+int cxlflash_vlun_resize(struct scsi_device *sdev, void *resize)
 {
 	return _cxlflash_vlun_resize(sdev, NULL, resize);
 }
@@ -1187,9 +1186,9 @@ static int clone_lxt(struct afu *afu,
  *
  * Return: 0 on success, -errno on failure
  */
-int cxlflash_disk_clone(struct scsi_device *sdev,
-			struct dk_cxlflash_clone *clone)
+int cxlflash_disk_clone(struct scsi_device *sdev, void *arg)
 {
+	struct dk_cxlflash_clone *clone = arg;
 	struct cxlflash_cfg *cfg = shost_priv(sdev->host);
 	struct device *dev = &cfg->dev->dev;
 	struct llun_info *lli = sdev->hostdata;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 08/12] x86: math-emu: fix function cast warnings
  2024-03-26 14:47 [PATCH 00/12] kbuild: enable some -Wextra warnings by default Arnd Bergmann
                   ` (6 preceding siblings ...)
  2024-03-26 14:51 ` [PATCH 07/12] cxlflash: fix function pointer cast warnings Arnd Bergmann
@ 2024-03-26 14:51 ` Arnd Bergmann
  2024-03-26 14:51 ` [PATCH 09/12] kbuild: enable -Wcast-function-type-strict unconditionally Arnd Bergmann
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2024-03-26 14:51 UTC (permalink / raw)
  To: linux-kbuild, Masahiro Yamada, Bill Metzenthen, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	Nathan Chancellor
  Cc: Nicolas Schier, Arnd Bergmann, H. Peter Anvin, Nick Desaulniers,
	Bill Wendling, Justin Stitt, linux-kernel, llvm

From: Arnd Bergmann <arnd@arndb.de>

clang-16 warns about casting function pointers with incompatible
prototypes. The x86 math-emu code does this in a number of places
to call some trivial functions that need no arguments:

arch/x86/math-emu/fpu_etc.c:124:14: error: cast from 'void (*)(void)' to 'FUNC_ST0' (aka 'void (*)(struct fpu__reg *, unsigned char)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  124 |         fchs, fabs, (FUNC_ST0) FPU_illegal, (FUNC_ST0) FPU_illegal,
      |                     ^~~~~~~~~~~~~~~~~~~~~~
arch/x86/math-emu/fpu_trig.c:1634:19: error: cast from 'void (*)(void)' to 'FUNC_ST0' (aka 'void (*)(struct fpu__reg *, unsigned char)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
 1634 |         fxtract, fprem1, (FUNC_ST0) fdecstp, (FUNC_ST0) fincstp
      |                          ^~~~~~~~~~~~~~~~~~
arch/x86/math-emu/reg_constant.c:112:53: error: cast from 'void (*)(void)' to 'FUNC_RC' (aka 'void (*)(int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  112 |         fld1, fldl2t, fldl2e, fldpi, fldlg2, fldln2, fldz, (FUNC_RC) FPU_illegal

Change the fdecstp() and fincstp() functions to actually have the correct
prototypes based on the caller, and add wrappers around FPU_illegal()
for adapting those.

Link: https://lore.kernel.org/lkml/20240213095631.454543-1-arnd@kernel.org/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
Resending the version from Feb 13, no changes
---
 arch/x86/math-emu/fpu_etc.c      | 9 +++++++--
 arch/x86/math-emu/fpu_trig.c     | 6 +++---
 arch/x86/math-emu/reg_constant.c | 7 ++++++-
 3 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/arch/x86/math-emu/fpu_etc.c b/arch/x86/math-emu/fpu_etc.c
index 1b118fd93140..39423ec409e1 100644
--- a/arch/x86/math-emu/fpu_etc.c
+++ b/arch/x86/math-emu/fpu_etc.c
@@ -120,9 +120,14 @@ static void fxam(FPU_REG *st0_ptr, u_char st0tag)
 	setcc(c);
 }
 
+static void FPU_ST0_illegal(FPU_REG *st0_ptr, u_char st0_tag)
+{
+	FPU_illegal();
+}
+
 static FUNC_ST0 const fp_etc_table[] = {
-	fchs, fabs, (FUNC_ST0) FPU_illegal, (FUNC_ST0) FPU_illegal,
-	ftst_, fxam, (FUNC_ST0) FPU_illegal, (FUNC_ST0) FPU_illegal
+	fchs, fabs, FPU_ST0_illegal, FPU_ST0_illegal,
+	ftst_, fxam, FPU_ST0_illegal, FPU_ST0_illegal,
 };
 
 void FPU_etc(void)
diff --git a/arch/x86/math-emu/fpu_trig.c b/arch/x86/math-emu/fpu_trig.c
index 990d847ae902..85daf98c81c3 100644
--- a/arch/x86/math-emu/fpu_trig.c
+++ b/arch/x86/math-emu/fpu_trig.c
@@ -433,13 +433,13 @@ static void fxtract(FPU_REG *st0_ptr, u_char st0_tag)
 #endif /* PARANOID */
 }
 
-static void fdecstp(void)
+static void fdecstp(FPU_REG *st0_ptr, u_char st0_tag)
 {
 	clear_C1();
 	top--;
 }
 
-static void fincstp(void)
+static void fincstp(FPU_REG *st0_ptr, u_char st0_tag)
 {
 	clear_C1();
 	top++;
@@ -1631,7 +1631,7 @@ static void fscale(FPU_REG *st0_ptr, u_char st0_tag)
 
 static FUNC_ST0 const trig_table_a[] = {
 	f2xm1, fyl2x, fptan, fpatan,
-	fxtract, fprem1, (FUNC_ST0) fdecstp, (FUNC_ST0) fincstp
+	fxtract, fprem1, fdecstp, fincstp,
 };
 
 void FPU_triga(void)
diff --git a/arch/x86/math-emu/reg_constant.c b/arch/x86/math-emu/reg_constant.c
index 742619e94bdf..003a0b2753e6 100644
--- a/arch/x86/math-emu/reg_constant.c
+++ b/arch/x86/math-emu/reg_constant.c
@@ -108,8 +108,13 @@ static void fldz(int rc)
 
 typedef void (*FUNC_RC) (int);
 
+static void FPU_RC_illegal(int unused)
+{
+	FPU_illegal();
+}
+
 static FUNC_RC constants_table[] = {
-	fld1, fldl2t, fldl2e, fldpi, fldlg2, fldln2, fldz, (FUNC_RC) FPU_illegal
+	fld1, fldl2t, fldl2e, fldpi, fldlg2, fldln2, fldz, FPU_RC_illegal
 };
 
 void fconst(void)
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 09/12] kbuild: enable -Wcast-function-type-strict unconditionally
  2024-03-26 14:47 [PATCH 00/12] kbuild: enable some -Wextra warnings by default Arnd Bergmann
                   ` (7 preceding siblings ...)
  2024-03-26 14:51 ` [PATCH 08/12] x86: math-emu: fix function " Arnd Bergmann
@ 2024-03-26 14:51 ` Arnd Bergmann
  2024-03-26 14:53 ` [PATCH 10/12] sata: sx4: fix pdc20621_get_from_dimm() on 64-bit Arnd Bergmann
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2024-03-26 14:51 UTC (permalink / raw)
  To: linux-kbuild, Masahiro Yamada
  Cc: Nicolas Schier, Nathan Chancellor, Arnd Bergmann, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

All known function cast warnings are now addressed, so the warning can
be enabled globally to catch new ones more quickly.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 scripts/Makefile.extrawarn | 1 -
 1 file changed, 1 deletion(-)

diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 17b00d85f6aa..889c0593a0c3 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -122,7 +122,6 @@ endif
 KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast)
 KBUILD_CFLAGS += -Wno-tautological-constant-out-of-range-compare
 KBUILD_CFLAGS += $(call cc-disable-warning, unaligned-access)
-KBUILD_CFLAGS += $(call cc-disable-warning, cast-function-type-strict)
 KBUILD_CFLAGS += -Wno-enum-compare-conditional
 KBUILD_CFLAGS += -Wno-enum-enum-conversion
 endif
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 10/12] sata: sx4: fix pdc20621_get_from_dimm() on 64-bit
  2024-03-26 14:47 [PATCH 00/12] kbuild: enable some -Wextra warnings by default Arnd Bergmann
                   ` (8 preceding siblings ...)
  2024-03-26 14:51 ` [PATCH 09/12] kbuild: enable -Wcast-function-type-strict unconditionally Arnd Bergmann
@ 2024-03-26 14:53 ` Arnd Bergmann
  2024-03-27  1:36   ` Damien Le Moal
  2024-03-26 14:53 ` [PATCH 11/12] [v4] kallsyms: rework symbol lookup return codes Arnd Bergmann
  2024-03-26 14:53 ` [PATCH 12/12] kbuild: turn on -Wrestrict by default Arnd Bergmann
  11 siblings, 1 reply; 36+ messages in thread
From: Arnd Bergmann @ 2024-03-26 14:53 UTC (permalink / raw)
  To: linux-kbuild, Masahiro Yamada, Damien Le Moal, Niklas Cassel
  Cc: Nicolas Schier, Nathan Chancellor, Arnd Bergmann, John Garry,
	Martin K. Petersen, linux-ide, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

gcc warns about a memcpy() with overlapping pointers because of an
incorrect size calculation:

In file included from include/linux/string.h:369,
                 from drivers/ata/sata_sx4.c:66:
In function 'memcpy_fromio',
    inlined from 'pdc20621_get_from_dimm.constprop' at drivers/ata/sata_sx4.c:962:2:
include/linux/fortify-string.h:97:33: error: '__builtin_memcpy' accessing 4294934464 bytes at offsets 0 and [16, 16400] overlaps 6442385281 bytes at offset -2147450817 [-Werror=restrict]
   97 | #define __underlying_memcpy     __builtin_memcpy
      |                                 ^
include/linux/fortify-string.h:620:9: note: in expansion of macro '__underlying_memcpy'
  620 |         __underlying_##op(p, q, __fortify_size);                        \
      |         ^~~~~~~~~~~~~
include/linux/fortify-string.h:665:26: note: in expansion of macro '__fortify_memcpy_chk'
  665 | #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
      |                          ^~~~~~~~~~~~~~~~~~~~
include/asm-generic/io.h:1184:9: note: in expansion of macro 'memcpy'
 1184 |         memcpy(buffer, __io_virt(addr), size);
      |         ^~~~~~

The problem here is the overflow of an unsigned 32-bit number to a
negative that gets converted into a signed 'long', keeping a large
positive number.

Replace the complex calculation with a more readable min() variant
that avoids the warning.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/ata/sata_sx4.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c
index b51d7a9d0d90..a482741eb181 100644
--- a/drivers/ata/sata_sx4.c
+++ b/drivers/ata/sata_sx4.c
@@ -957,8 +957,7 @@ static void pdc20621_get_from_dimm(struct ata_host *host, void *psource,
 
 	offset -= (idx * window_size);
 	idx++;
-	dist = ((long) (window_size - (offset + size))) >= 0 ? size :
-		(long) (window_size - offset);
+	dist = min(size, window_size - offset);
 	memcpy_fromio(psource, dimm_mmio + offset / 4, dist);
 
 	psource += dist;
@@ -1005,8 +1004,7 @@ static void pdc20621_put_to_dimm(struct ata_host *host, void *psource,
 	readl(mmio + PDC_DIMM_WINDOW_CTLR);
 	offset -= (idx * window_size);
 	idx++;
-	dist = ((long)(s32)(window_size - (offset + size))) >= 0 ? size :
-		(long) (window_size - offset);
+	dist = min(size, window_size - offset);
 	memcpy_toio(dimm_mmio + offset / 4, psource, dist);
 	writel(0x01, mmio + PDC_GENERAL_CTLR);
 	readl(mmio + PDC_GENERAL_CTLR);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 11/12] [v4] kallsyms: rework symbol lookup return codes
  2024-03-26 14:47 [PATCH 00/12] kbuild: enable some -Wextra warnings by default Arnd Bergmann
                   ` (9 preceding siblings ...)
  2024-03-26 14:53 ` [PATCH 10/12] sata: sx4: fix pdc20621_get_from_dimm() on 64-bit Arnd Bergmann
@ 2024-03-26 14:53 ` Arnd Bergmann
  2024-03-26 17:06   ` Steven Rostedt
  2024-03-26 14:53 ` [PATCH 12/12] kbuild: turn on -Wrestrict by default Arnd Bergmann
  11 siblings, 1 reply; 36+ messages in thread
From: Arnd Bergmann @ 2024-03-26 14:53 UTC (permalink / raw)
  To: linux-kbuild, Masahiro Yamada, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko, Steven Rostedt,
	Masami Hiramatsu, Luis Chamberlain
  Cc: Nicolas Schier, Nathan Chancellor, Arnd Bergmann,
	Eduard Zingerman, Song Liu, Yonghong Song, Kees Cook, bpf,
	linux-kernel, linux-trace-kernel, linux-modules

From: Arnd Bergmann <arnd@arndb.de>

Building with W=1 in some configurations produces a false positive
warning for kallsyms:

kernel/kallsyms.c: In function '__sprint_symbol.isra':
kernel/kallsyms.c:503:17: error: 'strcpy' source argument is the same as destination [-Werror=restrict]
  503 |                 strcpy(buffer, name);
      |                 ^~~~~~~~~~~~~~~~~~~~

This originally showed up while building with -O3, but later started
happening in other configurations as well, depending on inlining
decisions. The underlying issue is that the local 'name' variable is
always initialized to the be the same as 'buffer' in the called functions
that fill the buffer, which gcc notices while inlining, though it could
see that the address check always skips the copy.

The calling conventions here are rather unusual, as all of the internal
lookup functions (bpf_address_lookup, ftrace_mod_address_lookup,
ftrace_func_address_lookup, module_address_lookup and
kallsyms_lookup_buildid) already use the provided buffer and either return
the address of that buffer to indicate success, or NULL for failure,
but the callers are written to also expect an arbitrary other buffer
to be returned.

Rework the calling conventions to return the length of the filled buffer
instead of its address, which is simpler and easier to follow as well
as avoiding the warning. Leave only the kallsyms_lookup() calling conventions
unchanged, since that is called from 16 different functions and
adapting this would be a much bigger change.

Link: https://lore.kernel.org/all/20200107214042.855757-1-arnd@arndb.de/
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v4: fix string length
v3: use strscpy() instead of strlcpy()
v2: complete rewrite after the first patch was rejected (in 2020). This
    is now one of only two warnings that are in the way of enabling
    -Wextra/-Wrestrict by default.
---
 include/linux/filter.h   | 14 +++++++-------
 include/linux/ftrace.h   |  6 +++---
 include/linux/module.h   | 14 +++++++-------
 kernel/bpf/core.c        |  7 +++----
 kernel/kallsyms.c        | 23 ++++++++++++-----------
 kernel/module/kallsyms.c | 26 +++++++++++++-------------
 kernel/trace/ftrace.c    | 13 +++++--------
 7 files changed, 50 insertions(+), 53 deletions(-)

diff --git a/include/linux/filter.h b/include/linux/filter.h
index c99bc3df2d28..9d4a7c6f023e 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -1168,18 +1168,18 @@ static inline bool bpf_jit_kallsyms_enabled(void)
 	return false;
 }
 
-const char *__bpf_address_lookup(unsigned long addr, unsigned long *size,
+int __bpf_address_lookup(unsigned long addr, unsigned long *size,
 				 unsigned long *off, char *sym);
 bool is_bpf_text_address(unsigned long addr);
 int bpf_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
 		    char *sym);
 struct bpf_prog *bpf_prog_ksym_find(unsigned long addr);
 
-static inline const char *
+static inline int
 bpf_address_lookup(unsigned long addr, unsigned long *size,
 		   unsigned long *off, char **modname, char *sym)
 {
-	const char *ret = __bpf_address_lookup(addr, size, off, sym);
+	int ret = __bpf_address_lookup(addr, size, off, sym);
 
 	if (ret && modname)
 		*modname = NULL;
@@ -1223,11 +1223,11 @@ static inline bool bpf_jit_kallsyms_enabled(void)
 	return false;
 }
 
-static inline const char *
+static inline int
 __bpf_address_lookup(unsigned long addr, unsigned long *size,
 		     unsigned long *off, char *sym)
 {
-	return NULL;
+	return 0;
 }
 
 static inline bool is_bpf_text_address(unsigned long addr)
@@ -1246,11 +1246,11 @@ static inline struct bpf_prog *bpf_prog_ksym_find(unsigned long addr)
 	return NULL;
 }
 
-static inline const char *
+static inline int
 bpf_address_lookup(unsigned long addr, unsigned long *size,
 		   unsigned long *off, char **modname, char *sym)
 {
-	return NULL;
+	return 0;
 }
 
 static inline void bpf_prog_kallsyms_add(struct bpf_prog *fp)
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 54d53f345d14..56834a3fa9be 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -87,15 +87,15 @@ struct ftrace_direct_func;
 
 #if defined(CONFIG_FUNCTION_TRACER) && defined(CONFIG_MODULES) && \
 	defined(CONFIG_DYNAMIC_FTRACE)
-const char *
+int
 ftrace_mod_address_lookup(unsigned long addr, unsigned long *size,
 		   unsigned long *off, char **modname, char *sym);
 #else
-static inline const char *
+static inline int
 ftrace_mod_address_lookup(unsigned long addr, unsigned long *size,
 		   unsigned long *off, char **modname, char *sym)
 {
-	return NULL;
+	return 0;
 }
 #endif
 
diff --git a/include/linux/module.h b/include/linux/module.h
index 1153b0d99a80..118c36366b35 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -922,11 +922,11 @@ int module_kallsyms_on_each_symbol(const char *modname,
  * least KSYM_NAME_LEN long: a pointer to namebuf is returned if
  * found, otherwise NULL.
  */
-const char *module_address_lookup(unsigned long addr,
-				  unsigned long *symbolsize,
-				  unsigned long *offset,
-				  char **modname, const unsigned char **modbuildid,
-				  char *namebuf);
+int module_address_lookup(unsigned long addr,
+			  unsigned long *symbolsize,
+			  unsigned long *offset,
+			  char **modname, const unsigned char **modbuildid,
+			  char *namebuf);
 int lookup_module_symbol_name(unsigned long addr, char *symname);
 int lookup_module_symbol_attrs(unsigned long addr,
 			       unsigned long *size,
@@ -955,14 +955,14 @@ static inline int module_kallsyms_on_each_symbol(const char *modname,
 }
 
 /* For kallsyms to ask for address resolution.  NULL means not found. */
-static inline const char *module_address_lookup(unsigned long addr,
+static inline int module_address_lookup(unsigned long addr,
 						unsigned long *symbolsize,
 						unsigned long *offset,
 						char **modname,
 						const unsigned char **modbuildid,
 						char *namebuf)
 {
-	return NULL;
+	return 0;
 }
 
 static inline int lookup_module_symbol_name(unsigned long addr, char *symname)
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index 696bc55de8e8..ffc232333643 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -735,11 +735,11 @@ static struct bpf_ksym *bpf_ksym_find(unsigned long addr)
 	return n ? container_of(n, struct bpf_ksym, tnode) : NULL;
 }
 
-const char *__bpf_address_lookup(unsigned long addr, unsigned long *size,
+int __bpf_address_lookup(unsigned long addr, unsigned long *size,
 				 unsigned long *off, char *sym)
 {
 	struct bpf_ksym *ksym;
-	char *ret = NULL;
+	int ret = 0;
 
 	rcu_read_lock();
 	ksym = bpf_ksym_find(addr);
@@ -747,9 +747,8 @@ const char *__bpf_address_lookup(unsigned long addr, unsigned long *size,
 		unsigned long symbol_start = ksym->start;
 		unsigned long symbol_end = ksym->end;
 
-		strncpy(sym, ksym->name, KSYM_NAME_LEN);
+		ret = strscpy(sym, ksym->name, KSYM_NAME_LEN);
 
-		ret = sym;
 		if (size)
 			*size = symbol_end - symbol_start;
 		if (off)
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
index 18edd57b5fe8..eeb0e249e0e2 100644
--- a/kernel/kallsyms.c
+++ b/kernel/kallsyms.c
@@ -394,12 +394,12 @@ int kallsyms_lookup_size_offset(unsigned long addr, unsigned long *symbolsize,
 	       !!__bpf_address_lookup(addr, symbolsize, offset, namebuf);
 }
 
-static const char *kallsyms_lookup_buildid(unsigned long addr,
+static int kallsyms_lookup_buildid(unsigned long addr,
 			unsigned long *symbolsize,
 			unsigned long *offset, char **modname,
 			const unsigned char **modbuildid, char *namebuf)
 {
-	const char *ret;
+	int ret;
 
 	namebuf[KSYM_NAME_LEN - 1] = 0;
 	namebuf[0] = 0;
@@ -416,7 +416,7 @@ static const char *kallsyms_lookup_buildid(unsigned long addr,
 		if (modbuildid)
 			*modbuildid = NULL;
 
-		ret = namebuf;
+		ret = strlen(namebuf);
 		goto found;
 	}
 
@@ -448,8 +448,13 @@ const char *kallsyms_lookup(unsigned long addr,
 			    unsigned long *offset,
 			    char **modname, char *namebuf)
 {
-	return kallsyms_lookup_buildid(addr, symbolsize, offset, modname,
-				       NULL, namebuf);
+	int ret = kallsyms_lookup_buildid(addr, symbolsize, offset, modname,
+					  NULL, namebuf);
+
+	if (!ret)
+		return NULL;
+
+	return namebuf;
 }
 
 int lookup_symbol_name(unsigned long addr, char *symname)
@@ -484,19 +489,15 @@ static int __sprint_symbol(char *buffer, unsigned long address,
 {
 	char *modname;
 	const unsigned char *buildid;
-	const char *name;
 	unsigned long offset, size;
 	int len;
 
 	address += symbol_offset;
-	name = kallsyms_lookup_buildid(address, &size, &offset, &modname, &buildid,
+	len = kallsyms_lookup_buildid(address, &size, &offset, &modname, &buildid,
 				       buffer);
-	if (!name)
+	if (!len)
 		return sprintf(buffer, "0x%lx", address - symbol_offset);
 
-	if (name != buffer)
-		strcpy(buffer, name);
-	len = strlen(buffer);
 	offset -= symbol_offset;
 
 	if (add_offset)
diff --git a/kernel/module/kallsyms.c b/kernel/module/kallsyms.c
index ef73ae7c8909..6e6619a5b2f1 100644
--- a/kernel/module/kallsyms.c
+++ b/kernel/module/kallsyms.c
@@ -321,14 +321,15 @@ void * __weak dereference_module_function_descriptor(struct module *mod,
  * For kallsyms to ask for address resolution.  NULL means not found.  Careful
  * not to lock to avoid deadlock on oopses, simply disable preemption.
  */
-const char *module_address_lookup(unsigned long addr,
-				  unsigned long *size,
-			    unsigned long *offset,
-			    char **modname,
-			    const unsigned char **modbuildid,
-			    char *namebuf)
+int module_address_lookup(unsigned long addr,
+			  unsigned long *size,
+			  unsigned long *offset,
+			  char **modname,
+			  const unsigned char **modbuildid,
+			  char *namebuf)
 {
-	const char *ret = NULL;
+	const char *sym;
+	int ret = 0;
 	struct module *mod;
 
 	preempt_disable();
@@ -344,13 +345,12 @@ const char *module_address_lookup(unsigned long addr,
 #endif
 		}
 
-		ret = find_kallsyms_symbol(mod, addr, size, offset);
-	}
-	/* Make a copy in here where it's safe */
-	if (ret) {
-		strncpy(namebuf, ret, KSYM_NAME_LEN - 1);
-		ret = namebuf;
+		sym = find_kallsyms_symbol(mod, addr, size, offset);
+
+		if (sym)
+			ret = strscpy(namebuf, sym, KSYM_NAME_LEN);
 	}
+
 	preempt_enable();
 
 	return ret;
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index da1710499698..b40f9bd29080 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -6970,7 +6970,7 @@ allocate_ftrace_mod_map(struct module *mod,
 	return mod_map;
 }
 
-static const char *
+static int
 ftrace_func_address_lookup(struct ftrace_mod_map *mod_map,
 			   unsigned long addr, unsigned long *size,
 			   unsigned long *off, char *sym)
@@ -6991,21 +6991,18 @@ ftrace_func_address_lookup(struct ftrace_mod_map *mod_map,
 			*size = found_func->size;
 		if (off)
 			*off = addr - found_func->ip;
-		if (sym)
-			strscpy(sym, found_func->name, KSYM_NAME_LEN);
-
-		return found_func->name;
+		return strscpy(sym, found_func->name, KSYM_NAME_LEN);
 	}
 
-	return NULL;
+	return 0;
 }
 
-const char *
+int
 ftrace_mod_address_lookup(unsigned long addr, unsigned long *size,
 		   unsigned long *off, char **modname, char *sym)
 {
 	struct ftrace_mod_map *mod_map;
-	const char *ret = NULL;
+	int ret;
 
 	/* mod_map is freed via call_rcu() */
 	preempt_disable();
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 12/12] kbuild: turn on -Wrestrict by default
  2024-03-26 14:47 [PATCH 00/12] kbuild: enable some -Wextra warnings by default Arnd Bergmann
                   ` (10 preceding siblings ...)
  2024-03-26 14:53 ` [PATCH 11/12] [v4] kallsyms: rework symbol lookup return codes Arnd Bergmann
@ 2024-03-26 14:53 ` Arnd Bergmann
  11 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2024-03-26 14:53 UTC (permalink / raw)
  To: linux-kbuild, Masahiro Yamada
  Cc: Nicolas Schier, Nathan Chancellor, Arnd Bergmann, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

All known -Wrestrict warnings are addressed now, so don't disable the warning
any more.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 scripts/Makefile.extrawarn | 1 -
 1 file changed, 1 deletion(-)

diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 889c0593a0c3..bff6c686df7c 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -97,7 +97,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)
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCH 06/12] nouveau: fix function cast warning
  2024-03-26 14:51 ` [PATCH 06/12] nouveau: fix function cast warning Arnd Bergmann
@ 2024-03-26 15:20   ` Timur Tabi
  2024-03-26 16:02     ` Arnd Bergmann
  0 siblings, 1 reply; 36+ messages in thread
From: Timur Tabi @ 2024-03-26 15:20 UTC (permalink / raw)
  To: masahiroy, kherbst, linux-kbuild, arnd, lyude, bskeggs, airlied,
	dakr, nathan, daniel
  Cc: justinstitt, dri-devel, morbo, nouveau, arnd, nicolas,
	ndesaulniers, linux-kernel, llvm

On Tue, 2024-03-26 at 15:51 +0100, Arnd Bergmann wrote:
> Calling a function through an incompatible pointer type causes breaks
> kcfi, so clang warns about the assignment:
> 

...

> +static void of_fini(void *p)
> +{
> +       return kfree(p);
> +}
> +

I don't know anything about kfci, but shouldn't this just be "kfree(p)",
without the "return"?


^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 06/12] nouveau: fix function cast warning
  2024-03-26 15:20   ` Timur Tabi
@ 2024-03-26 16:02     ` Arnd Bergmann
  0 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2024-03-26 16:02 UTC (permalink / raw)
  To: Timur Tabi, Masahiro Yamada, kherbst, linux-kbuild,
	Arnd Bergmann, Lyude Paul, bskeggs, Dave Airlie,
	Danilo Krummrich, Nathan Chancellor, Daniel Vetter
  Cc: Justin Stitt, dri-devel, Bill Wendling, nouveau, Nicolas Schier,
	Nick Desaulniers, linux-kernel, llvm

On Tue, Mar 26, 2024, at 16:20, Timur Tabi wrote:
> On Tue, 2024-03-26 at 15:51 +0100, Arnd Bergmann wrote:
>> Calling a function through an incompatible pointer type causes breaks
>> kcfi, so clang warns about the assignment:
>> 
>
> ...
>
>> +static void of_fini(void *p)
>> +{
>> +       return kfree(p);
>> +}
>> +
>
> I don't know anything about kfci, but shouldn't this just be "kfree(p)",
> without the "return"?

You are right, fixed this up locally now, waiting for more
comments before I resend patches from my series.

I think it works because of a gcc extension, but isn't
valid C otherwise, and I did not mean to rely on this.

     Arnd

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent
  2024-03-26 14:47 ` [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent Arnd Bergmann
@ 2024-03-26 16:04   ` Hamza Mahfooz
  2024-03-26 20:24   ` Jani Nikula
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 36+ messages in thread
From: Hamza Mahfooz @ 2024-03-26 16:04 UTC (permalink / raw)
  To: Arnd Bergmann, linux-kbuild, Masahiro Yamada, Harry Wentland,
	Alex Deucher, Christian König, Jani Nikula, Lucas De Marchi,
	Oded Gabbay, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Jakub Kicinski, Paolo Abeni, Andrew Jeffery, Linus Walleij,
	Joel Stanley, Alexei Starovoitov, Daniel Borkmann, Andrew Morton,
	Nathan Chancellor
  Cc: Nicolas Schier, Arnd Bergmann, dri-devel, linux-kernel, netdev,
	linux-mm, llvm, amd-gfx

Cc: amd-gfx@lists.freedesktop.org

On 3/26/24 10:47, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The -Woverride-init warn about code that may be intentional or not,
> but the inintentional ones tend to be real bugs, so there is a bit of
> disagreement on whether this warning option should be enabled by default
> and we have multiple settings in scripts/Makefile.extrawarn as well as
> individual subsystems.
> 
> Older versions of clang only supported -Wno-initializer-overrides with
> the same meaning as gcc's -Woverride-init, though all supported versions
> now work with both. Because of this difference, an earlier cleanup of
> mine accidentally turned the clang warning off for W=1 builds and only
> left it on for W=2, while it's still enabled for gcc with W=1.
> 
> There is also one driver that only turns the warning off for newer
> versions of gcc but not other compilers, and some but not all the
> Makefiles still use a cc-disable-warning conditional that is no
> longer needed with supported compilers here.
> 
> Address all of the above by removing the special cases for clang
> and always turning the warning off unconditionally where it got
> in the way, using the syntax that is supported by both compilers.
> 
> Fixes: 2cd3271b7a31 ("kbuild: avoid duplicate warning options")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Hamza Mahfooz <hamza.mahfooz@amd.com>

For the amdgpu changes.

> ---
>   drivers/gpu/drm/amd/display/dc/dce110/Makefile |  2 +-
>   drivers/gpu/drm/amd/display/dc/dce112/Makefile |  2 +-
>   drivers/gpu/drm/amd/display/dc/dce120/Makefile |  2 +-
>   drivers/gpu/drm/amd/display/dc/dce60/Makefile  |  2 +-
>   drivers/gpu/drm/amd/display/dc/dce80/Makefile  |  2 +-
>   drivers/gpu/drm/i915/Makefile                  |  6 +++---
>   drivers/gpu/drm/xe/Makefile                    |  4 ++--
>   drivers/net/ethernet/renesas/sh_eth.c          |  2 +-
>   drivers/pinctrl/aspeed/Makefile                |  2 +-
>   fs/proc/Makefile                               |  2 +-
>   kernel/bpf/Makefile                            |  2 +-
>   mm/Makefile                                    |  3 +--
>   scripts/Makefile.extrawarn                     | 10 +++-------
>   13 files changed, 18 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/dce110/Makefile b/drivers/gpu/drm/amd/display/dc/dce110/Makefile
> index f0777d61c2cb..c307f040e48f 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce110/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dce110/Makefile
> @@ -23,7 +23,7 @@
>   # Makefile for the 'controller' sub-component of DAL.
>   # It provides the control and status of HW CRTC block.
>   
> -CFLAGS_$(AMDDALPATH)/dc/dce110/dce110_resource.o = $(call cc-disable-warning, override-init)
> +CFLAGS_$(AMDDALPATH)/dc/dce110/dce110_resource.o = -Wno-override-init
>   
>   DCE110 = dce110_timing_generator.o \
>   dce110_compressor.o dce110_opp_regamma_v.o \
> diff --git a/drivers/gpu/drm/amd/display/dc/dce112/Makefile b/drivers/gpu/drm/amd/display/dc/dce112/Makefile
> index 7e92effec894..683866797709 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce112/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dce112/Makefile
> @@ -23,7 +23,7 @@
>   # Makefile for the 'controller' sub-component of DAL.
>   # It provides the control and status of HW CRTC block.
>   
> -CFLAGS_$(AMDDALPATH)/dc/dce112/dce112_resource.o = $(call cc-disable-warning, override-init)
> +CFLAGS_$(AMDDALPATH)/dc/dce112/dce112_resource.o = -Wno-override-init
>   
>   DCE112 = dce112_compressor.o
>   
> diff --git a/drivers/gpu/drm/amd/display/dc/dce120/Makefile b/drivers/gpu/drm/amd/display/dc/dce120/Makefile
> index 1e3ef68a452a..8f508e662748 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce120/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dce120/Makefile
> @@ -24,7 +24,7 @@
>   # It provides the control and status of HW CRTC block.
>   
>   
> -CFLAGS_$(AMDDALPATH)/dc/dce120/dce120_resource.o = $(call cc-disable-warning, override-init)
> +CFLAGS_$(AMDDALPATH)/dc/dce120/dce120_resource.o = -Wno-override-init
>   
>   DCE120 = dce120_timing_generator.o
>   
> diff --git a/drivers/gpu/drm/amd/display/dc/dce60/Makefile b/drivers/gpu/drm/amd/display/dc/dce60/Makefile
> index fee331accc0e..eede83ad91fa 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce60/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dce60/Makefile
> @@ -23,7 +23,7 @@
>   # Makefile for the 'controller' sub-component of DAL.
>   # It provides the control and status of HW CRTC block.
>   
> -CFLAGS_$(AMDDALPATH)/dc/dce60/dce60_resource.o = $(call cc-disable-warning, override-init)
> +CFLAGS_$(AMDDALPATH)/dc/dce60/dce60_resource.o = -Wno-override-init
>   
>   DCE60 = dce60_timing_generator.o dce60_hw_sequencer.o \
>   	dce60_resource.o
> diff --git a/drivers/gpu/drm/amd/display/dc/dce80/Makefile b/drivers/gpu/drm/amd/display/dc/dce80/Makefile
> index 7eefffbdc925..fba189d26652 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce80/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dce80/Makefile
> @@ -23,7 +23,7 @@
>   # Makefile for the 'controller' sub-component of DAL.
>   # It provides the control and status of HW CRTC block.
>   
> -CFLAGS_$(AMDDALPATH)/dc/dce80/dce80_resource.o = $(call cc-disable-warning, override-init)
> +CFLAGS_$(AMDDALPATH)/dc/dce80/dce80_resource.o = -Wno-override-init
>   
>   DCE80 = dce80_timing_generator.o
>   
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index 3ef6ed41e62b..4c2f85632391 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -33,9 +33,9 @@ endif
>   subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror
>   
>   # Fine grained warnings disable
> -CFLAGS_i915_pci.o = $(call cc-disable-warning, override-init)
> -CFLAGS_display/intel_display_device.o = $(call cc-disable-warning, override-init)
> -CFLAGS_display/intel_fbdev.o = $(call cc-disable-warning, override-init)
> +CFLAGS_i915_pci.o = -Wno-override-init
> +CFLAGS_display/intel_display_device.o = -Wno-override-init
> +CFLAGS_display/intel_fbdev.o = -Wno-override-init
>   
>   # Support compiling the display code separately for both i915 and xe
>   # drivers. Define I915 when building i915.
> diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile
> index 5a428ca00f10..c29a850859ad 100644
> --- a/drivers/gpu/drm/xe/Makefile
> +++ b/drivers/gpu/drm/xe/Makefile
> @@ -172,8 +172,8 @@ subdir-ccflags-$(CONFIG_DRM_XE_DISPLAY) += \
>   	-Ddrm_i915_gem_object=xe_bo \
>   	-Ddrm_i915_private=xe_device
>   
> -CFLAGS_i915-display/intel_fbdev.o = $(call cc-disable-warning, override-init)
> -CFLAGS_i915-display/intel_display_device.o = $(call cc-disable-warning, override-init)
> +CFLAGS_i915-display/intel_fbdev.o = -Wno-override-init
> +CFLAGS_i915-display/intel_display_device.o = -Wno-override-init
>   
>   # Rule to build SOC code shared with i915
>   $(obj)/i915-soc/%.o: $(srctree)/drivers/gpu/drm/i915/soc/%.c FORCE
> diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
> index 475e1e8c1d35..0786eb0da391 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -50,7 +50,7 @@
>    * the macros available to do this only define GCC 8.
>    */
>   __diag_push();
> -__diag_ignore(GCC, 8, "-Woverride-init",
> +__diag_ignore_all("-Woverride-init",
>   	      "logic to initialize all and then override some is OK");
>   static const u16 sh_eth_offset_gigabit[SH_ETH_MAX_REGISTER_OFFSET] = {
>   	SH_ETH_OFFSET_DEFAULTS,
> diff --git a/drivers/pinctrl/aspeed/Makefile b/drivers/pinctrl/aspeed/Makefile
> index 489ea1778353..db2a7600ae2b 100644
> --- a/drivers/pinctrl/aspeed/Makefile
> +++ b/drivers/pinctrl/aspeed/Makefile
> @@ -1,7 +1,7 @@
>   # SPDX-License-Identifier: GPL-2.0-only
>   # Aspeed pinctrl support
>   
> -ccflags-y += $(call cc-option,-Woverride-init)
> +ccflags-y += -Woverride-init
>   obj-$(CONFIG_PINCTRL_ASPEED)	+= pinctrl-aspeed.o pinmux-aspeed.o
>   obj-$(CONFIG_PINCTRL_ASPEED_G4)	+= pinctrl-aspeed-g4.o
>   obj-$(CONFIG_PINCTRL_ASPEED_G5)	+= pinctrl-aspeed-g5.o
> diff --git a/fs/proc/Makefile b/fs/proc/Makefile
> index bd08616ed8ba..7b4db9c56e6a 100644
> --- a/fs/proc/Makefile
> +++ b/fs/proc/Makefile
> @@ -5,7 +5,7 @@
>   
>   obj-y   += proc.o
>   
> -CFLAGS_task_mmu.o	+= $(call cc-option,-Wno-override-init,)
> +CFLAGS_task_mmu.o	+= -Wno-override-init
>   proc-y			:= nommu.o task_nommu.o
>   proc-$(CONFIG_MMU)	:= task_mmu.o
>   
> diff --git a/kernel/bpf/Makefile b/kernel/bpf/Makefile
> index 368c5d86b5b7..e497011261b8 100644
> --- a/kernel/bpf/Makefile
> +++ b/kernel/bpf/Makefile
> @@ -4,7 +4,7 @@ ifneq ($(CONFIG_BPF_JIT_ALWAYS_ON),y)
>   # ___bpf_prog_run() needs GCSE disabled on x86; see 3193c0836f203 for details
>   cflags-nogcse-$(CONFIG_X86)$(CONFIG_CC_IS_GCC) := -fno-gcse
>   endif
> -CFLAGS_core.o += $(call cc-disable-warning, override-init) $(cflags-nogcse-yy)
> +CFLAGS_core.o += -Wno-override-init $(cflags-nogcse-yy)
>   
>   obj-$(CONFIG_BPF_SYSCALL) += syscall.o verifier.o inode.o helpers.o tnum.o log.o token.o
>   obj-$(CONFIG_BPF_SYSCALL) += bpf_iter.o map_iter.o task_iter.o prog_iter.o link_iter.o
> diff --git a/mm/Makefile b/mm/Makefile
> index e4b5b75aaec9..4abb40b911ec 100644
> --- a/mm/Makefile
> +++ b/mm/Makefile
> @@ -29,8 +29,7 @@ KCOV_INSTRUMENT_mmzone.o := n
>   KCOV_INSTRUMENT_vmstat.o := n
>   KCOV_INSTRUMENT_failslab.o := n
>   
> -CFLAGS_init-mm.o += $(call cc-disable-warning, override-init)
> -CFLAGS_init-mm.o += $(call cc-disable-warning, initializer-overrides)
> +CFLAGS_init-mm.o += -Wno-override-init
>   
>   mmu-y			:= nommu.o
>   mmu-$(CONFIG_MMU)	:= highmem.o memory.o mincore.o \
> diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
> index 3ce5d503a6da..c5af566e911a 100644
> --- a/scripts/Makefile.extrawarn
> +++ b/scripts/Makefile.extrawarn
> @@ -114,6 +114,8 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
>   KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation)
>   KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation)
>   
> +KBUILD_CFLAGS += -Wno-override-init # alias for -Wno-initializer-overrides in clang
> +
>   ifdef CONFIG_CC_IS_CLANG
>   # Clang before clang-16 would warn on default argument promotions.
>   ifneq ($(call clang-min-version, 160000),y)
> @@ -151,10 +153,6 @@ KBUILD_CFLAGS += -Wtype-limits
>   KBUILD_CFLAGS += $(call cc-option, -Wmaybe-uninitialized)
>   KBUILD_CFLAGS += $(call cc-option, -Wunused-macros)
>   
> -ifdef CONFIG_CC_IS_CLANG
> -KBUILD_CFLAGS += -Winitializer-overrides
> -endif
> -
>   KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN2
>   
>   else
> @@ -164,9 +162,7 @@ KBUILD_CFLAGS += -Wno-missing-field-initializers
>   KBUILD_CFLAGS += -Wno-type-limits
>   KBUILD_CFLAGS += -Wno-shift-negative-value
>   
> -ifdef CONFIG_CC_IS_CLANG
> -KBUILD_CFLAGS += -Wno-initializer-overrides
> -else
> +ifdef CONFIG_CC_IS_GCC
>   KBUILD_CFLAGS += -Wno-maybe-uninitialized
>   endif
>   
-- 
Hamza


^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 11/12] [v4] kallsyms: rework symbol lookup return codes
  2024-03-26 14:53 ` [PATCH 11/12] [v4] kallsyms: rework symbol lookup return codes Arnd Bergmann
@ 2024-03-26 17:06   ` Steven Rostedt
  2024-03-26 17:10     ` Arnd Bergmann
  0 siblings, 1 reply; 36+ messages in thread
From: Steven Rostedt @ 2024-03-26 17:06 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kbuild, Masahiro Yamada, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko, Masami Hiramatsu,
	Luis Chamberlain, Nicolas Schier, Nathan Chancellor,
	Arnd Bergmann, Eduard Zingerman, Song Liu, Yonghong Song,
	Kees Cook, bpf, linux-kernel, linux-trace-kernel, linux-modules

On Tue, 26 Mar 2024 15:53:38 +0100
Arnd Bergmann <arnd@kernel.org> wrote:

> -const char *
> +int
>  ftrace_mod_address_lookup(unsigned long addr, unsigned long *size,
>  		   unsigned long *off, char **modname, char *sym)
>  {
>  	struct ftrace_mod_map *mod_map;
> -	const char *ret = NULL;
> +	int ret;

This needs to be ret = 0;

>  
>  	/* mod_map is freed via call_rcu() */
>  	preempt_disable();

As here we have:

	list_for_each_entry_rcu(mod_map, &ftrace_mod_maps, list) {
		ret = ftrace_func_address_lookup(mod_map, addr, size, off, sym);
		if (ret) {
			if (modname)
				*modname = mod_map->mod->name;
			break;
		}
	}
	preempt_enable();

	return ret;
}

Where it is possible for the loop never to be executed.

-- Steve

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 11/12] [v4] kallsyms: rework symbol lookup return codes
  2024-03-26 17:06   ` Steven Rostedt
@ 2024-03-26 17:10     ` Arnd Bergmann
  0 siblings, 0 replies; 36+ messages in thread
From: Arnd Bergmann @ 2024-03-26 17:10 UTC (permalink / raw)
  To: Steven Rostedt, Arnd Bergmann
  Cc: linux-kbuild, Masahiro Yamada, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko, Masami Hiramatsu,
	Luis Chamberlain, Nicolas Schier, Nathan Chancellor,
	Eduard Zingerman, Song Liu, Yonghong Song, Kees Cook, bpf,
	linux-kernel, linux-trace-kernel, linux-modules

On Tue, Mar 26, 2024, at 18:06, Steven Rostedt wrote:
> On Tue, 26 Mar 2024 15:53:38 +0100
> Arnd Bergmann <arnd@kernel.org> wrote:
>
>> -const char *
>> +int
>>  ftrace_mod_address_lookup(unsigned long addr, unsigned long *size,
>>  		   unsigned long *off, char **modname, char *sym)
>>  {
>>  	struct ftrace_mod_map *mod_map;
>> -	const char *ret = NULL;
>> +	int ret;
>
> This needs to be ret = 0;

Fixed now, thanks!

I'll send a v5 in a few days 

    Arnd

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent
  2024-03-26 14:47 ` [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent Arnd Bergmann
  2024-03-26 16:04   ` Hamza Mahfooz
@ 2024-03-26 20:24   ` Jani Nikula
  2024-03-26 20:55     ` Arnd Bergmann
  2024-03-26 23:02   ` Andrew Jeffery
  2024-03-28  9:18   ` Linus Walleij
  3 siblings, 1 reply; 36+ messages in thread
From: Jani Nikula @ 2024-03-26 20:24 UTC (permalink / raw)
  To: Arnd Bergmann, linux-kbuild, Masahiro Yamada, Harry Wentland,
	Alex Deucher, Christian König, Lucas De Marchi, Oded Gabbay,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Jakub Kicinski, Paolo Abeni, Andrew Jeffery, Linus Walleij,
	Joel Stanley, Alexei Starovoitov, Daniel Borkmann, Andrew Morton,
	Nathan Chancellor
  Cc: Nicolas Schier, Arnd Bergmann, dri-devel, linux-kernel, netdev,
	linux-mm, llvm

On Tue, 26 Mar 2024, Arnd Bergmann <arnd@kernel.org> wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The -Woverride-init warn about code that may be intentional or not,
> but the inintentional ones tend to be real bugs, so there is a bit of
> disagreement on whether this warning option should be enabled by default
> and we have multiple settings in scripts/Makefile.extrawarn as well as
> individual subsystems.
>
> Older versions of clang only supported -Wno-initializer-overrides with
> the same meaning as gcc's -Woverride-init, though all supported versions
> now work with both. Because of this difference, an earlier cleanup of
> mine accidentally turned the clang warning off for W=1 builds and only
> left it on for W=2, while it's still enabled for gcc with W=1.
>
> There is also one driver that only turns the warning off for newer
> versions of gcc but not other compilers, and some but not all the
> Makefiles still use a cc-disable-warning conditional that is no
> longer needed with supported compilers here.
>
> Address all of the above by removing the special cases for clang
> and always turning the warning off unconditionally where it got
> in the way, using the syntax that is supported by both compilers.
>
> Fixes: 2cd3271b7a31 ("kbuild: avoid duplicate warning options")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/gpu/drm/amd/display/dc/dce110/Makefile |  2 +-
>  drivers/gpu/drm/amd/display/dc/dce112/Makefile |  2 +-
>  drivers/gpu/drm/amd/display/dc/dce120/Makefile |  2 +-
>  drivers/gpu/drm/amd/display/dc/dce60/Makefile  |  2 +-
>  drivers/gpu/drm/amd/display/dc/dce80/Makefile  |  2 +-
>  drivers/gpu/drm/i915/Makefile                  |  6 +++---
>  drivers/gpu/drm/xe/Makefile                    |  4 ++--
>  drivers/net/ethernet/renesas/sh_eth.c          |  2 +-
>  drivers/pinctrl/aspeed/Makefile                |  2 +-
>  fs/proc/Makefile                               |  2 +-
>  kernel/bpf/Makefile                            |  2 +-
>  mm/Makefile                                    |  3 +--
>  scripts/Makefile.extrawarn                     | 10 +++-------
>  13 files changed, 18 insertions(+), 23 deletions(-)
>

[snip]

> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index 3ef6ed41e62b..4c2f85632391 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -33,9 +33,9 @@ endif
>  subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror
>  
>  # Fine grained warnings disable
> -CFLAGS_i915_pci.o = $(call cc-disable-warning, override-init)
> -CFLAGS_display/intel_display_device.o = $(call cc-disable-warning, override-init)
> -CFLAGS_display/intel_fbdev.o = $(call cc-disable-warning, override-init)
> +CFLAGS_i915_pci.o = -Wno-override-init
> +CFLAGS_display/intel_display_device.o = -Wno-override-init
> +CFLAGS_display/intel_fbdev.o = -Wno-override-init
>  
>  # Support compiling the display code separately for both i915 and xe
>  # drivers. Define I915 when building i915.
> diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile
> index 5a428ca00f10..c29a850859ad 100644
> --- a/drivers/gpu/drm/xe/Makefile
> +++ b/drivers/gpu/drm/xe/Makefile
> @@ -172,8 +172,8 @@ subdir-ccflags-$(CONFIG_DRM_XE_DISPLAY) += \
>  	-Ddrm_i915_gem_object=xe_bo \
>  	-Ddrm_i915_private=xe_device
>  
> -CFLAGS_i915-display/intel_fbdev.o = $(call cc-disable-warning, override-init)
> -CFLAGS_i915-display/intel_display_device.o = $(call cc-disable-warning, override-init)
> +CFLAGS_i915-display/intel_fbdev.o = -Wno-override-init
> +CFLAGS_i915-display/intel_display_device.o = -Wno-override-init

For i915 and xe parts,

Acked-by: Jani Nikula <jani.nikula@intel.com>

>  # Rule to build SOC code shared with i915
>  $(obj)/i915-soc/%.o: $(srctree)/drivers/gpu/drm/i915/soc/%.c FORCE
> diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
> index 475e1e8c1d35..0786eb0da391 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -50,7 +50,7 @@
>   * the macros available to do this only define GCC 8.
>   */
>  __diag_push();
> -__diag_ignore(GCC, 8, "-Woverride-init",
> +__diag_ignore_all("-Woverride-init",
>  	      "logic to initialize all and then override some is OK");

This is nice because it's more localized than the per-file
disable. However, we tried to do this in i915, but this doesn't work for
GCC versions < 8, and some defconfigs enabling -Werror forced us to
revert. See commit 290d16104575 ("Revert "drm/i915: use localized
__diag_ignore_all() instead of per file"").

BR,
Jani.


-- 
Jani Nikula, Intel

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent
  2024-03-26 20:24   ` Jani Nikula
@ 2024-03-26 20:55     ` Arnd Bergmann
  2024-03-27  7:50       ` Jani Nikula
  0 siblings, 1 reply; 36+ messages in thread
From: Arnd Bergmann @ 2024-03-26 20:55 UTC (permalink / raw)
  To: Jani Nikula, Arnd Bergmann, linux-kbuild, Masahiro Yamada,
	Harry Wentland, Alex Deucher, Christian König,
	Lucas De Marchi, Oded Gabbay, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Jakub Kicinski, Paolo Abeni, Andrew Jeffery,
	Linus Walleij, Joel Stanley, Alexei Starovoitov, Daniel Borkmann,
	Andrew Morton, Nathan Chancellor
  Cc: Nicolas Schier, dri-devel, linux-kernel, Netdev, linux-mm, llvm

On Tue, Mar 26, 2024, at 21:24, Jani Nikula wrote:
> On Tue, 26 Mar 2024, Arnd Bergmann <arnd@kernel.org> wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>> index 475e1e8c1d35..0786eb0da391 100644
>> --- a/drivers/net/ethernet/renesas/sh_eth.c
>> +++ b/drivers/net/ethernet/renesas/sh_eth.c
>> @@ -50,7 +50,7 @@
>>   * the macros available to do this only define GCC 8.
>>   */
>>  __diag_push();
>> -__diag_ignore(GCC, 8, "-Woverride-init",
>> +__diag_ignore_all("-Woverride-init",
>>  	      "logic to initialize all and then override some is OK");
>
> This is nice because it's more localized than the per-file
> disable. However, we tried to do this in i915, but this doesn't work for
> GCC versions < 8, and some defconfigs enabling -Werror forced us to
> revert. See commit 290d16104575 ("Revert "drm/i915: use localized
> __diag_ignore_all() instead of per file"").

It works now.

The original __diag_ignore_all() only did it for gcc-8 and above
because that was initially needed to suppress warnings that
got added in that version, but this was always a mistake.

689b097a06ba ("compiler-gcc: Suppress -Wmissing-prototypes
warning for all supported GCC") made it work correctly.

     Arnd

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent
  2024-03-26 14:47 ` [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent Arnd Bergmann
  2024-03-26 16:04   ` Hamza Mahfooz
  2024-03-26 20:24   ` Jani Nikula
@ 2024-03-26 23:02   ` Andrew Jeffery
  2024-03-28  9:18   ` Linus Walleij
  3 siblings, 0 replies; 36+ messages in thread
From: Andrew Jeffery @ 2024-03-26 23:02 UTC (permalink / raw)
  To: Arnd Bergmann, linux-kbuild, Masahiro Yamada, Harry Wentland,
	Alex Deucher, Christian König, Jani Nikula, Lucas De Marchi,
	Oded Gabbay, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Jakub Kicinski, Paolo Abeni, Linus Walleij, Joel Stanley,
	Alexei Starovoitov, Daniel Borkmann, Andrew Morton,
	Nathan Chancellor
  Cc: Nicolas Schier, Arnd Bergmann, dri-devel, linux-kernel, netdev,
	linux-mm, llvm

On Tue, 2024-03-26 at 15:47 +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The -Woverride-init warn about code that may be intentional or not,
> but the inintentional ones tend to be real bugs, so there is a bit of
> disagreement on whether this warning option should be enabled by default
> and we have multiple settings in scripts/Makefile.extrawarn as well as
> individual subsystems.
> 
> Older versions of clang only supported -Wno-initializer-overrides with
> the same meaning as gcc's -Woverride-init, though all supported versions
> now work with both. Because of this difference, an earlier cleanup of
> mine accidentally turned the clang warning off for W=1 builds and only
> left it on for W=2, while it's still enabled for gcc with W=1.
> 
> There is also one driver that only turns the warning off for newer
> versions of gcc but not other compilers, and some but not all the
> Makefiles still use a cc-disable-warning conditional that is no
> longer needed with supported compilers here.
> 
> Address all of the above by removing the special cases for clang
> and always turning the warning off unconditionally where it got
> in the way, using the syntax that is supported by both compilers.
> 
> Fixes: 2cd3271b7a31 ("kbuild: avoid duplicate warning options")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/gpu/drm/amd/display/dc/dce110/Makefile |  2 +-
>  drivers/gpu/drm/amd/display/dc/dce112/Makefile |  2 +-
>  drivers/gpu/drm/amd/display/dc/dce120/Makefile |  2 +-
>  drivers/gpu/drm/amd/display/dc/dce60/Makefile  |  2 +-
>  drivers/gpu/drm/amd/display/dc/dce80/Makefile  |  2 +-
>  drivers/gpu/drm/i915/Makefile                  |  6 +++---
>  drivers/gpu/drm/xe/Makefile                    |  4 ++--
>  drivers/net/ethernet/renesas/sh_eth.c          |  2 +-
>  drivers/pinctrl/aspeed/Makefile                |  2 +-

For the Aspeed change:

Acked-by: Andrew Jeffery <andrew@codeconstruct.com.au>

Thanks!

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 10/12] sata: sx4: fix pdc20621_get_from_dimm() on 64-bit
  2024-03-26 14:53 ` [PATCH 10/12] sata: sx4: fix pdc20621_get_from_dimm() on 64-bit Arnd Bergmann
@ 2024-03-27  1:36   ` Damien Le Moal
  2024-03-27 20:21     ` Arnd Bergmann
  0 siblings, 1 reply; 36+ messages in thread
From: Damien Le Moal @ 2024-03-27  1:36 UTC (permalink / raw)
  To: Arnd Bergmann, linux-kbuild, Masahiro Yamada, Niklas Cassel
  Cc: Nicolas Schier, Nathan Chancellor, Arnd Bergmann, John Garry,
	Martin K. Petersen, linux-ide, linux-kernel

On 3/26/24 23:53, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> gcc warns about a memcpy() with overlapping pointers because of an
> incorrect size calculation:
> 
> In file included from include/linux/string.h:369,
>                  from drivers/ata/sata_sx4.c:66:
> In function 'memcpy_fromio',
>     inlined from 'pdc20621_get_from_dimm.constprop' at drivers/ata/sata_sx4.c:962:2:
> include/linux/fortify-string.h:97:33: error: '__builtin_memcpy' accessing 4294934464 bytes at offsets 0 and [16, 16400] overlaps 6442385281 bytes at offset -2147450817 [-Werror=restrict]
>    97 | #define __underlying_memcpy     __builtin_memcpy
>       |                                 ^
> include/linux/fortify-string.h:620:9: note: in expansion of macro '__underlying_memcpy'
>   620 |         __underlying_##op(p, q, __fortify_size);                        \
>       |         ^~~~~~~~~~~~~
> include/linux/fortify-string.h:665:26: note: in expansion of macro '__fortify_memcpy_chk'
>   665 | #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
>       |                          ^~~~~~~~~~~~~~~~~~~~
> include/asm-generic/io.h:1184:9: note: in expansion of macro 'memcpy'
>  1184 |         memcpy(buffer, __io_virt(addr), size);
>       |         ^~~~~~
> 
> The problem here is the overflow of an unsigned 32-bit number to a
> negative that gets converted into a signed 'long', keeping a large
> positive number.
> 
> Replace the complex calculation with a more readable min() variant
> that avoids the warning.
> 
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")

That is old :)

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Looks good to me. I can take the patch through libata tree, unless you prefer
taking the whole series ?

In case it is the latter:

Acked-by: Damien Le Moal <dlemoal@kernel.org>

-- 
Damien Le Moal
Western Digital Research


^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent
  2024-03-26 20:55     ` Arnd Bergmann
@ 2024-03-27  7:50       ` Jani Nikula
  2024-03-27  9:22         ` Arnd Bergmann
  0 siblings, 1 reply; 36+ messages in thread
From: Jani Nikula @ 2024-03-27  7:50 UTC (permalink / raw)
  To: Arnd Bergmann, Arnd Bergmann, linux-kbuild, Masahiro Yamada,
	Harry Wentland, Alex Deucher, Christian König,
	Lucas De Marchi, Oded Gabbay, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Jakub Kicinski, Paolo Abeni, Andrew Jeffery,
	Linus Walleij, Joel Stanley, Alexei Starovoitov, Daniel Borkmann,
	Andrew Morton, Nathan Chancellor
  Cc: Nicolas Schier, dri-devel, linux-kernel, Netdev, linux-mm, llvm

On Tue, 26 Mar 2024, "Arnd Bergmann" <arnd@arndb.de> wrote:
> On Tue, Mar 26, 2024, at 21:24, Jani Nikula wrote:
>> On Tue, 26 Mar 2024, Arnd Bergmann <arnd@kernel.org> wrote:
>>> From: Arnd Bergmann <arnd@arndb.de>
>>> index 475e1e8c1d35..0786eb0da391 100644
>>> --- a/drivers/net/ethernet/renesas/sh_eth.c
>>> +++ b/drivers/net/ethernet/renesas/sh_eth.c
>>> @@ -50,7 +50,7 @@
>>>   * the macros available to do this only define GCC 8.
>>>   */
>>>  __diag_push();
>>> -__diag_ignore(GCC, 8, "-Woverride-init",
>>> +__diag_ignore_all("-Woverride-init",
>>>  	      "logic to initialize all and then override some is OK");
>>
>> This is nice because it's more localized than the per-file
>> disable. However, we tried to do this in i915, but this doesn't work for
>> GCC versions < 8, and some defconfigs enabling -Werror forced us to
>> revert. See commit 290d16104575 ("Revert "drm/i915: use localized
>> __diag_ignore_all() instead of per file"").
>
> It works now.
>
> The original __diag_ignore_all() only did it for gcc-8 and above
> because that was initially needed to suppress warnings that
> got added in that version, but this was always a mistake.
>
> 689b097a06ba ("compiler-gcc: Suppress -Wmissing-prototypes
> warning for all supported GCC") made it work correctly.

Oh, nice! Then I think we'd like to go back to __diag_ignore_all() in
i915 and xe.

The diff is below. I'm fine with you squashing it to your patch, or if
you want me to turn it into a proper patch for you to pick up in your
series, that's fine too. Just let me know.

BR,
Jani.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>


diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 3ef6ed41e62b..87d6ba8d2341 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -32,11 +32,6 @@ endif
 # Enable -Werror in CI and development
 subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror
 
-# Fine grained warnings disable
-CFLAGS_i915_pci.o = $(call cc-disable-warning, override-init)
-CFLAGS_display/intel_display_device.o = $(call cc-disable-warning, override-init)
-CFLAGS_display/intel_fbdev.o = $(call cc-disable-warning, override-init)
-
 # Support compiling the display code separately for both i915 and xe
 # drivers. Define I915 when building i915.
 subdir-ccflags-y += -DI915
diff --git a/drivers/gpu/drm/i915/display/intel_display_device.c b/drivers/gpu/drm/i915/display/intel_display_device.c
index c02d79b50006..b8903bd0e82a 100644
--- a/drivers/gpu/drm/i915/display/intel_display_device.c
+++ b/drivers/gpu/drm/i915/display/intel_display_device.c
@@ -17,6 +17,9 @@
 #include "intel_display_reg_defs.h"
 #include "intel_fbc.h"
 
+__diag_push();
+__diag_ignore_all("-Woverride-init", "Allow field initialization overrides for display info");
+
 static const struct intel_display_device_info no_display = {};
 
 #define PIPE_A_OFFSET		0x70000
@@ -768,6 +771,8 @@ static const struct intel_display_device_info xe2_lpd_display = {
 		BIT(INTEL_FBC_C) | BIT(INTEL_FBC_D),
 };
 
+__diag_pop();
+
 /*
  * Separate detection for no display cases to keep the display id array simple.
  *
diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
index 99894a855ef0..43855c6c3509 100644
--- a/drivers/gpu/drm/i915/display/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
@@ -135,6 +135,9 @@ static int intel_fbdev_mmap(struct fb_info *info, struct vm_area_struct *vma)
 	return i915_gem_fb_mmap(obj, vma);
 }
 
+__diag_push();
+__diag_ignore_all("-Woverride-init", "Allow field initialization overrides for fb ops");
+
 static const struct fb_ops intelfb_ops = {
 	.owner = THIS_MODULE,
 	__FB_DEFAULT_DEFERRED_OPS_RDWR(intel_fbdev),
@@ -146,6 +149,8 @@ static const struct fb_ops intelfb_ops = {
 	.fb_mmap = intel_fbdev_mmap,
 };
 
+__diag_pop();
+
 static int intelfb_create(struct drm_fb_helper *helper,
 			  struct drm_fb_helper_surface_size *sizes)
 {
diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
index 1e69783ae4fd..405ca17a990b 100644
--- a/drivers/gpu/drm/i915/i915_pci.c
+++ b/drivers/gpu/drm/i915/i915_pci.c
@@ -38,6 +38,9 @@
 #include "i915_reg.h"
 #include "intel_pci_config.h"
 
+__diag_push();
+__diag_ignore_all("-Woverride-init", "Allow field initialization overrides for device info");
+
 #define PLATFORM(x) .platform = (x)
 #define GEN(x) \
 	.__runtime.graphics.ip.ver = (x), \
@@ -785,6 +788,8 @@ static const struct intel_device_info mtl_info = {
 
 #undef PLATFORM
 
+__diag_pop();
+
 /*
  * Make sure any device matches here are from most specific to most
  * general.  For example, since the Quanta match is based on the subsystem
diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile
index 3c3e67885559..2f58faf0a79a 100644
--- a/drivers/gpu/drm/xe/Makefile
+++ b/drivers/gpu/drm/xe/Makefile
@@ -172,9 +172,6 @@ subdir-ccflags-$(CONFIG_DRM_XE_DISPLAY) += \
 	-Ddrm_i915_gem_object=xe_bo \
 	-Ddrm_i915_private=xe_device
 
-CFLAGS_i915-display/intel_fbdev.o = $(call cc-disable-warning, override-init)
-CFLAGS_i915-display/intel_display_device.o = $(call cc-disable-warning, override-init)
-
 # Rule to build SOC code shared with i915
 $(obj)/i915-soc/%.o: $(srctree)/drivers/gpu/drm/i915/soc/%.c FORCE
 	$(call cmd,force_checksrc)

-- 
Jani Nikula, Intel

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent
  2024-03-27  7:50       ` Jani Nikula
@ 2024-03-27  9:22         ` Arnd Bergmann
  2024-03-31  2:33           ` Masahiro Yamada
  0 siblings, 1 reply; 36+ messages in thread
From: Arnd Bergmann @ 2024-03-27  9:22 UTC (permalink / raw)
  To: Jani Nikula, Arnd Bergmann, linux-kbuild, Masahiro Yamada,
	Harry Wentland, Alex Deucher, Christian König,
	Lucas De Marchi, Oded Gabbay, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Jakub Kicinski, Paolo Abeni, Andrew Jeffery,
	Linus Walleij, Joel Stanley, Alexei Starovoitov, Daniel Borkmann,
	Andrew Morton, Nathan Chancellor
  Cc: Nicolas Schier, dri-devel, linux-kernel, Netdev, linux-mm, llvm

On Wed, Mar 27, 2024, at 08:50, Jani Nikula wrote:
> On Tue, 26 Mar 2024, "Arnd Bergmann" <arnd@arndb.de> wrote:
>> On Tue, Mar 26, 2024, at 21:24, Jani Nikula wrote:
>>> On Tue, 26 Mar 2024, Arnd Bergmann <arnd@kernel.org> wrote:
>>
>> It works now.
>>
>> The original __diag_ignore_all() only did it for gcc-8 and above
>> because that was initially needed to suppress warnings that
>> got added in that version, but this was always a mistake.
>>
>> 689b097a06ba ("compiler-gcc: Suppress -Wmissing-prototypes
>> warning for all supported GCC") made it work correctly.
>
> Oh, nice! Then I think we'd like to go back to __diag_ignore_all() in
> i915 and xe.
>
> The diff is below. I'm fine with you squashing it to your patch, or if
> you want me to turn it into a proper patch for you to pick up in your
> series, that's fine too. Just let me know.

I think I'd prefer to keep my patch simpler for the moment and
get that merged through the kbuild tree, it already touches
too many places at once.

It may be better for me to just drop the drivers/gpu/ part of
my patch so you can just just take your patch through the
drm tree. I actually have a similar patch for the amdgpu driver
that I can send if you like this option better.

    Arnd

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 10/12] sata: sx4: fix pdc20621_get_from_dimm() on 64-bit
  2024-03-27  1:36   ` Damien Le Moal
@ 2024-03-27 20:21     ` Arnd Bergmann
  2024-03-28  0:14       ` Damien Le Moal
  0 siblings, 1 reply; 36+ messages in thread
From: Arnd Bergmann @ 2024-03-27 20:21 UTC (permalink / raw)
  To: Damien Le Moal, Arnd Bergmann, linux-kbuild, Masahiro Yamada,
	Niklas Cassel
  Cc: Nicolas Schier, Nathan Chancellor, John Garry,
	Martin K. Petersen, linux-ide, linux-kernel

On Wed, Mar 27, 2024, at 02:36, Damien Le Moal wrote:
> On 3/26/24 23:53, Arnd Bergmann wrote:
>
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> Looks good to me. I can take the patch through libata tree, unless you prefer
> taking the whole series ?

Please merge it through your tree.

> In case it is the latter:
>
> Acked-by: Damien Le Moal <dlemoal@kernel.org>
>

Thanks,

    Arnd

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 10/12] sata: sx4: fix pdc20621_get_from_dimm() on 64-bit
  2024-03-27 20:21     ` Arnd Bergmann
@ 2024-03-28  0:14       ` Damien Le Moal
  0 siblings, 0 replies; 36+ messages in thread
From: Damien Le Moal @ 2024-03-28  0:14 UTC (permalink / raw)
  To: Arnd Bergmann, Arnd Bergmann, linux-kbuild, Masahiro Yamada,
	Niklas Cassel
  Cc: Nicolas Schier, Nathan Chancellor, John Garry,
	Martin K. Petersen, linux-ide, linux-kernel

On 3/28/24 05:21, Arnd Bergmann wrote:
> On Wed, Mar 27, 2024, at 02:36, Damien Le Moal wrote:
>> On 3/26/24 23:53, Arnd Bergmann wrote:
>>
>>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>
>> Looks good to me. I can take the patch through libata tree, unless you prefer
>> taking the whole series ?
> 
> Please merge it through your tree.

Applied to for-6.9-fixes with a fixed up patch title prefix ("ata: sata_sx4:
..."). Thanks !

> 
>> In case it is the latter:
>>
>> Acked-by: Damien Le Moal <dlemoal@kernel.org>
>>
> 
> Thanks,
> 
>     Arnd

-- 
Damien Le Moal
Western Digital Research


^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent
  2024-03-26 14:47 ` [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent Arnd Bergmann
                     ` (2 preceding siblings ...)
  2024-03-26 23:02   ` Andrew Jeffery
@ 2024-03-28  9:18   ` Linus Walleij
  3 siblings, 0 replies; 36+ messages in thread
From: Linus Walleij @ 2024-03-28  9:18 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kbuild, Masahiro Yamada, Harry Wentland, Alex Deucher,
	Christian König, Jani Nikula, Lucas De Marchi, Oded Gabbay,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Jakub Kicinski, Paolo Abeni, Andrew Jeffery, Joel Stanley,
	Alexei Starovoitov, Daniel Borkmann, Andrew Morton,
	Nathan Chancellor, Nicolas Schier, Arnd Bergmann, dri-devel,
	linux-kernel, netdev, linux-mm, llvm

On Tue, Mar 26, 2024 at 3:49 PM Arnd Bergmann <arnd@kernel.org> wrote:

> From: Arnd Bergmann <arnd@arndb.de>
>
> The -Woverride-init warn about code that may be intentional or not,
> but the inintentional ones tend to be real bugs, so there is a bit of
> disagreement on whether this warning option should be enabled by default
> and we have multiple settings in scripts/Makefile.extrawarn as well as
> individual subsystems.
>
> Older versions of clang only supported -Wno-initializer-overrides with
> the same meaning as gcc's -Woverride-init, though all supported versions
> now work with both. Because of this difference, an earlier cleanup of
> mine accidentally turned the clang warning off for W=1 builds and only
> left it on for W=2, while it's still enabled for gcc with W=1.
>
> There is also one driver that only turns the warning off for newer
> versions of gcc but not other compilers, and some but not all the
> Makefiles still use a cc-disable-warning conditional that is no
> longer needed with supported compilers here.
>
> Address all of the above by removing the special cases for clang
> and always turning the warning off unconditionally where it got
> in the way, using the syntax that is supported by both compilers.
>
> Fixes: 2cd3271b7a31 ("kbuild: avoid duplicate warning options")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Neat!
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 05/12] firmware: dmi-id: add a release callback function
  2024-03-26 14:51 ` [PATCH 05/12] firmware: dmi-id: add a release callback function Arnd Bergmann
@ 2024-03-29 12:49   ` Jean Delvare
  2024-03-29 16:12     ` Nathan Chancellor
  2024-04-04 14:07     ` Arnd Bergmann
  0 siblings, 2 replies; 36+ messages in thread
From: Jean Delvare @ 2024-03-29 12:49 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kbuild, Masahiro Yamada, Nathan Chancellor,
	Greg Kroah-Hartman, Nicolas Schier, Arnd Bergmann,
	Nick Desaulniers, Bill Wendling, Justin Stitt, linux-kernel,
	llvm

Hi Arnd,

On Tue, 26 Mar 2024 15:51:30 +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> dmi_class uses kfree() as the .release function, but that now causes
> a warning with clang-16 as it violates control flow integrity (KCFI)
> rules:
> 
> drivers/firmware/dmi-id.c:174:17: error: cast from 'void (*)(const void *)' to 'void (*)(struct device *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
>   174 |         .dev_release = (void(*)(struct device *)) kfree,
> 
> Add an explicit function to call kfree() instead.
> 
> Fixes: 4f5c791a850e ("DMI-based module autoloading")

Not sure if this fixes tag is really warranted. As I understand it,
your change only removes a warning but there was no actual bug, right?

> Link: https://lore.kernel.org/lkml/20240213100238.456912-1-arnd@kernel.org/
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> I sent this before but got no comments for it

I indeed overlooked your initial submission, my bad.

> ---
>  drivers/firmware/dmi-id.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/firmware/dmi-id.c b/drivers/firmware/dmi-id.c
> index 5f3a3e913d28..d19c78a78ae3 100644
> --- a/drivers/firmware/dmi-id.c
> +++ b/drivers/firmware/dmi-id.c
> @@ -169,9 +169,14 @@ static int dmi_dev_uevent(const struct device *dev, struct kobj_uevent_env *env)
>  	return 0;
>  }
>  
> +static void dmi_dev_release(struct device *dev)
> +{
> +	kfree(dev);
> +}
> +
>  static struct class dmi_class = {
>  	.name = "dmi",
> -	.dev_release = (void(*)(struct device *)) kfree,
> +	.dev_release = dmi_dev_release,
>  	.dev_uevent = dmi_dev_uevent,
>  };
>  

Looks good to me, thanks for doing that.

Signed-off-by: Jean Delvare <jdelvare@suse.de>

Will you get this upstream, or do you expect me to take it in my
dmi/for-next branch?

-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 05/12] firmware: dmi-id: add a release callback function
  2024-03-29 12:49   ` Jean Delvare
@ 2024-03-29 16:12     ` Nathan Chancellor
  2024-04-04 14:07     ` Arnd Bergmann
  1 sibling, 0 replies; 36+ messages in thread
From: Nathan Chancellor @ 2024-03-29 16:12 UTC (permalink / raw)
  To: Jean Delvare
  Cc: Arnd Bergmann, linux-kbuild, Masahiro Yamada, Greg Kroah-Hartman,
	Nicolas Schier, Arnd Bergmann, Nick Desaulniers, Bill Wendling,
	Justin Stitt, linux-kernel, llvm

On Fri, Mar 29, 2024 at 01:49:17PM +0100, Jean Delvare wrote:
> Hi Arnd,
> 
> On Tue, 26 Mar 2024 15:51:30 +0100, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> > 
> > dmi_class uses kfree() as the .release function, but that now causes
> > a warning with clang-16 as it violates control flow integrity (KCFI)
> > rules:
> > 
> > drivers/firmware/dmi-id.c:174:17: error: cast from 'void (*)(const void *)' to 'void (*)(struct device *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
> >   174 |         .dev_release = (void(*)(struct device *)) kfree,
> > 
> > Add an explicit function to call kfree() instead.
> > 
> > Fixes: 4f5c791a850e ("DMI-based module autoloading")
> 
> Not sure if this fixes tag is really warranted. As I understand it,
> your change only removes a warning but there was no actual bug, right?

Sort of, the warning is really pointing out that calling this callback
will result in a crash at runtime when the kernel is built with kCFI
enabled, which I would consider a bug.

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent
  2024-03-27  9:22         ` Arnd Bergmann
@ 2024-03-31  2:33           ` Masahiro Yamada
  2024-03-31  2:33             ` Masahiro Yamada
  0 siblings, 1 reply; 36+ messages in thread
From: Masahiro Yamada @ 2024-03-31  2:33 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Jani Nikula, Arnd Bergmann, linux-kbuild, Harry Wentland,
	Alex Deucher, Christian König, Lucas De Marchi, Oded Gabbay,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Jakub Kicinski, Paolo Abeni, Andrew Jeffery, Linus Walleij,
	Joel Stanley, Alexei Starovoitov, Daniel Borkmann, Andrew Morton,
	Nathan Chancellor, Nicolas Schier, dri-devel, linux-kernel,
	Netdev, linux-mm, llvm

On Wed, Mar 27, 2024 at 6:23 PM Arnd Bergmann <arnd@arndb.de> wrote:
>
> On Wed, Mar 27, 2024, at 08:50, Jani Nikula wrote:
> > On Tue, 26 Mar 2024, "Arnd Bergmann" <arnd@arndb.de> wrote:
> >> On Tue, Mar 26, 2024, at 21:24, Jani Nikula wrote:
> >>> On Tue, 26 Mar 2024, Arnd Bergmann <arnd@kernel.org> wrote:
> >>
> >> It works now.
> >>
> >> The original __diag_ignore_all() only did it for gcc-8 and above
> >> because that was initially needed to suppress warnings that
> >> got added in that version, but this was always a mistake.
> >>
> >> 689b097a06ba ("compiler-gcc: Suppress -Wmissing-prototypes
> >> warning for all supported GCC") made it work correctly.
> >
> > Oh, nice! Then I think we'd like to go back to __diag_ignore_all() in
> > i915 and xe.
> >
> > The diff is below. I'm fine with you squashing it to your patch, or if
> > you want me to turn it into a proper patch for you to pick up in your
> > series, that's fine too. Just let me know.
>
> I think I'd prefer to keep my patch simpler for the moment and
> get that merged through the kbuild tree, it already touches
> too many places at once.
>
> It may be better for me to just drop the drivers/gpu/ part of
> my patch so you can just just take your patch through the
> drm tree. I actually have a similar patch for the amdgpu driver
> that I can send if you like this option better.
>
>     Arnd
>



Applied to linux-kbuild/fixes.
Thanks.

-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent
  2024-03-31  2:33           ` Masahiro Yamada
@ 2024-03-31  2:33             ` Masahiro Yamada
  0 siblings, 0 replies; 36+ messages in thread
From: Masahiro Yamada @ 2024-03-31  2:33 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Jani Nikula, Arnd Bergmann, linux-kbuild, Harry Wentland,
	Alex Deucher, Christian König, Lucas De Marchi, Oded Gabbay,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Jakub Kicinski, Paolo Abeni, Andrew Jeffery, Linus Walleij,
	Joel Stanley, Alexei Starovoitov, Daniel Borkmann, Andrew Morton,
	Nathan Chancellor, Nicolas Schier, dri-devel, linux-kernel,
	Netdev, linux-mm, llvm

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 18242 bytes --]

On Wed, Mar 27, 2024 at 6:23 PM Arnd Bergmann <arnd@arndb.de> wrote:
>
> On Wed, Mar 27, 2024, at 08:50, Jani Nikula wrote:
> > On Tue, 26 Mar 2024, "Arnd Bergmann" <arnd@arndb.de> wrote:
> >> On Tue, Mar 26, 2024, at 21:24, Jani Nikula wrote:
> >>> On Tue, 26 Mar 2024, Arnd Bergmann <arnd@kernel.org> wrote:
> >>
> >> It works now.
> >>
> >> The original __diag_ignore_all() only did it for gcc-8 and above
> >> because that was initially needed to suppress warnings that
> >> got added in that version, but this was always a mistake.
> >>
> >> 689b097a06ba ("compiler-gcc: Suppress -Wmissing-prototypes
> >> warning for all supported GCC") made it work correctly.
> >
> > Oh, nice! Then I think we'd like to go back to __diag_ignore_all() in
> > i915 and xe.
> >
> > The diff is below. I'm fine with you squashing it to your patch, or if
> > you want me to turn it into a proper patch for you to pick up in your
> > series, that's fine too. Just let me know.
>
> I think I'd prefer to keep my patch simpler for the moment and
> get that merged through the kbuild tree, it already touches
> too many places at once.
>
> It may be better for me to just drop the drivers/gpu/ part of
> my patch so you can just just take your patch through the
> drm tree. I actually have a similar patch for the amdgpu driver
> that I can send if you like this option better.
>
>     Arnd
>



Applied to linux-kbuild/fixes.
Thanks.

-- 
Best Regards
Masahiro Yamada

X-sender: <linux-kernel+bounces-125929-steffen.klassert=cunet.com@vger.kernel.org>
X-Receiver: <steffen.klassert@secunet.com> ORCPT=c822;steffen.klassert@secunet.com NOTIFY=VER; X-ExtendedProps=AVABYAAgAAAAUAFAARAPDFCS25BAlDktII2g02frgPADUAAABNaWNyb3NvZnQuRXhjaGFuZ2UuVHJhbnNwb3J0LkRpcmVjdG9yeURhdGEuSXNSZXNvdXJjZQIAAAUAagAJAAEAAAAAAAAABQAWAAIAAAUAQwACAAAFAEYABwADAAAABQBHAAIAAAUAEgAPAGIAAAAvbz1zZWN1bmV0L291PUV4Y2hhbmdlIEFkbWluaXN0cmF0aXZlIEdyb3VwIChGWURJQk9IRjIzU1BETFQpL2NuPVJlY2lwaWVudHMvY249U3RlZmZlbiBLbGFzc2VydDY4YwUACwAXAL4AAACheZxkHSGBRqAcAp3ukbifQ049REI2LENOPURhdGFiYXNlcyxDTj1FeGNoYW5nZSBBZG1pbmlzdHJhdGl2ZSBHcm91cCAoRllESUJPSEYyM1NQRExUKSxDTj1BZG1pbmlzdHJhdGl2ZSBHcm91cHMsQ049c2VjdW5ldCxDTj1NaWNyb3NvZnQgRXhjaGFuZ2UsQ049U2VydmljZXMsQ049Q29uZmlndXJhdGlvbixEQz1zZWN1bmV0LERDPWRlBQAOABEABiAS9uuMOkqzwmEZDvWNNQUAHQAPAAwAAABtYngtZXNzZW4tMDIFADwAAgAADwA2AAAATWljcm9zb2Z0LkV4Y2hhbmdlLlRyYW5zcG9ydC5NYWlsUmVjaXBpZW50LkRpc3BsYXlOYW1lDwARAAAAS2xhc3NlcnQsIFN0ZWZmZW4FAAwAAgAABQBsAAIAAAUAWAAXAEoAAADwxQktuQQJQ5LSCNoNNn64Q049S2xhc3NlcnQgU3RlZmZlbixPVT1Vc2VycyxPVT1NaWdyYXRpb24sREM9c2VjdW5ldCxEQz1kZQUAJgACAAEFACIADwAxAAAAQXV0b1Jlc3BvbnNlU3VwcHJlc3M6IDANClRyYW5zbWl0SGlzdG9yeTogRmFsc2UNCg8ALwAAAE1pY3Jvc29mdC5FeGNoYW5nZS5UcmFuc3BvcnQuRXhwYW5zaW9uR3JvdXBUeXBlDwAVAAAATWVtYmVyc0dyb3VwRXhwYW5zaW9uBQAjAAIAAQ=
X-CreatedBy: MSExchange15
X-HeloDomain: a.mx.secunet.com
X-ExtendedProps: BQBjAAoAJWsFfe5Q3AgFAGEACAABAAAABQA3AAIAAA8APAAAAE1pY3Jvc29mdC5FeGNoYW5nZS5UcmFuc3BvcnQuTWFpbFJlY2lwaWVudC5Pcmdhbml6YXRpb25TY29wZREAAAAAAAAAAAAAAAAAAAAAAAUASQACAAEFAAQAFCABAAAAHAAAAHN0ZWZmZW4ua2xhc3NlcnRAc2VjdW5ldC5jb20FAAYAAgABBQApAAIAAQ8ACQAAAENJQXVkaXRlZAIAAQUAAgAHAAEAAAAFAAMABwAAAAAABQAFAAIAAQUAYgAKAF4AAADpigAABQBkAA8AAwAAAEh1Yg=
X-Source: SMTP:Default MBX-ESSEN-02
X-SourceIPAddress: 62.96.220.36
X-EndOfInjectedXHeaders: 15141
Received: from cas-essen-01.secunet.de (10.53.40.201) by
 mbx-essen-02.secunet.de (10.53.40.198) with Microsoft SMTP Server
 (version=S1_2, cipher=S_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.2507.37; Sun, 31 Mar 2024 04:34:25 +0200
Received: from a.mx.secunet.com (62.96.220.36) by cas-essen-01.secunet.de
 (10.53.40.201) with Microsoft SMTP Server (version=S1_2,
 cipher=S_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37 via Frontend
 Transport; Sun, 31 Mar 2024 04:34:25 +0200
Received: from localhost (localhost [127.0.0.1])
	by a.mx.secunet.com (Postfix) with ESMTP id 6D21320892
	for <steffen.klassert@secunet.com>; Sun, 31 Mar 2024 04:34:25 +0200 (CEST)
X-Virus-Scanned: by secunet
X-Spam-Flag: NO
X-Spam-Score: -1.2
X-Spam-Level:
X-Spam-Status: No, score=.2 tagged_above=99 required=1
	tests=KIMWL_WL_HIGH=.1, DKIM_SIGNED=1, DKIM_VALID=.1,
	DKIM_VALID_AU=.1, MAILING_LIST_MULTI=, RCVD_IN_DNSWL_NONE=.0001,
	SPF_HELO_NONE=001, SPF_PASS=.001]
	autolearn=available autolearn_force=
Authentication-Results: a.mx.secunet.com (amavisd-new);
	dkim=ss (2048-bit key) header.d=rnel.org
Received: from a.mx.secunet.com ([127.0.0.1])
	by localhost (a.mx.secunet.com [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id ymmiznFv0woJ for <steffen.klassert@secunet.com>;
	Sun, 31 Mar 2024 04:34:25 +0200 (CEST)
Received-SPF: Pass (sender SPF authorized) identity=ilfrom; client-ip\x147.75.80.249; helo=.mirrors.kernel.org; envelope-from=nux-kernel+bounces-125929-steffen.klassert=cunet.com@vger.kernel.org; receiver=effen.klassert@secunet.com 
DKIM-Filter: OpenDKIM Filter v2.11.0 a.mx.secunet.com E4C94207FD
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by a.mx.secunet.com (Postfix) with ESMTPS id E4C94207FD
	for <steffen.klassert@secunet.com>; Sun, 31 Mar 2024 04:34:24 +0200 (CEST)
Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by am.mirrors.kernel.org (Postfix) with ESMTPS id 5C02B1F218D2
	for <steffen.klassert@secunet.com>; Sun, 31 Mar 2024 02:34:24 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 9BB2C4416;
	Sun, 31 Mar 2024 02:34:07 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
	dkim=ss (2048-bit key) header.d=rnel.org header.i=ernel.org header.b=Z9D70uV"
Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2FA3D184E;
	Sun, 31 Mar 2024 02:34:04 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=ne smtp.client-ip\x10.30.226.201
ARC-Seal: i= a=a-sha256; d=bspace.kernel.org; s=c-20240116;
	t\x1711852445; cv=ne; b=9ztFoeNFC8W8Bmk7O2Z5NF1FqYCQSQXvXHwYXp92impW8yqIqXKztodGBRpXQU5wfGBPjF30T0jKjGp+dRMIVrE9+rHt+E/sK11cG0ccYiCxhujgs6p0ewfBT+tyH81Ba1BpjFwcgtUyVZk4Fx9c+IJDc8Pbb3UqAFDp4kjvQARC-Message-Signature: i= a=a-sha256; d=bspace.kernel.org;
	s=c-20240116; t\x1711852445; c=laxed/simple;
	bh=xtEveTESmqEmgqfqi/AHy+l/CY7o7HoCu99ORDDcA=
	h=ME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:
	 To:Cc:Content-Type; b=xe4cBbfRJV3gpTvYKFbbR/6Oo8CmYNpvDoIAdyEoT+Fst6iaUXtghvq3ijq3w1+V6jl8iuUhxs26iFUlXrzTxzkigqaTs5dnoEnR/bLxwsiIwpFFcP1wwql0Rd0L+n+/bc3NcLBp7LSIEUyTq3KbDcKWe4NXrWGbBy3k5Tsu0ARC-Authentication-Results: i= smtp.subspace.kernel.org; dkim=ss (2048-bit key) header.d=rnel.org header.i=ernel.org header.b=9D70uV; arc=ne smtp.client-ip\x10.30.226.201
Received: by smtp.kernel.org (Postfix) with ESMTPSA id A71FCC433B2;
	Sun, 31 Mar 2024 02:34:04 +0000 (UTC)
DKIM-Signature: v= a=a-sha256; c=laxed/simple; d=rnel.org;
	s=0201202; t\x1711852444;
	bh=xtEveTESmqEmgqfqi/AHy+l/CY7o7HoCu99ORDDcA=
	h=ferences:In-Reply-To:From:Date:Subject:To:Cc:From;
	b=9D70uVOm8Q1eV7TepfO1FkN+1k1kWNkT6Ku6f/2s6iTAOV7tZxn2zhkvPsVyaFX
	 RPw7j/3dyOXbWPTqh7GDBBmESHoa0/CSjp3BgTh7gbx5KJ1tdiDym07g+AY4FzPgQS
	 DKX7tgoR9K9mHdV/+tGZPsttPaEAScJJhqA81HNprVN9Fu9EJ0XTEzkGTvbaVJb6Hx
	 Qzks5PLB5vorWVg53klblNq3phtjvnvFZqLRpBY/lb0TuCBuxS4GgeeCTYGb+VI6ok
	 zfc1qtwfOHsXCTucSL4Xb61hPPubFgtHkxN2eCV1J182QybCpwgfTt0/4sSb25g/FL
	 PUk6ZaAAFbN5g=
Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-513d23be0b6so3396180e87.0;
        Sat, 30 Mar 2024 19:34:04 -0700 (PDT)
X-Forwarded-Encrypted: i= AJvYcCVDkGXqULJb0iTE30zok3Z/DcAitzYB9HUyf5pQ/qSbH7TnoDghRS696d3Z3Bc7u3vJtKOCIyp0hkqFnVKFWXLHRnz0A8czvwM7M2KtNDkdHOpr2c074bO9nltfNZLNpXSwZIksKCLZNGtZiA0bHX646SeY+kLLS+WUzjnVm4MKEuoM
X-Gm-Message-State: AOJu0YzWfQ4zDI0K2CTviHTVM/YUaXaFBBv4MmJVL07IxX6zt/sEhULv
	8wYbpd4A6ohvhE1X1s1afNGS2g9DPx2m3V/0v8z3Oa7dpCwciQaRAnkxDrAd98WqSrH+OiQMNXB
	qPMEzBdnsGuo/e1Si+icML8zVNFYX-Google-Smtp-Source: AGHT+IGpEQPL0v7g3+p+5E8g7HGnWQKzlMop6CryhqCRVmhK61t313PDdp5vf1ukKDWFXpyLX2tmge1Ix/vKXAwQ4u4X-Received: by 2002:a2e:9914:0:b0:2d4:6aba:f1a9 with SMTP id
 v20-20020a2e9914000000b002d46abaf1a9mr4254960lji.40.1711852443253; Sat, 30
 Mar 2024 19:34:03 -0700 (PDT)
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
References: <20240326144741.3094687-1-arnd@kernel.org> <20240326144741.3094687-2-arnd@kernel.org>
 <87jzlohhbc.fsf@intel.com> <cb853762-06d4-401c-a1c8-07a0c031b499@app.fastmail.com>
 <87edbwglle.fsf@intel.com> <07c604d1-6304-4ff8-844b-03c3d5c727ad@app.fastmail.com>
In-Reply-To: <07c604d1-6304-4ff8-844b-03c3d5c727ad@app.fastmail.com>
From: Masahiro Yamada <masahiroy@kernel.org>
Date: Sun, 31 Mar 2024 11:33:27 +0900
X-Gmail-Original-Message-ID: <CAK7LNARmABUDDTFtp_HCqKid7€11wk0HMgHYGHWOLunhpxXA@mail.gmail.com>
Message-ID: <CAK7LNARmABUDDTFtp_HCqKid7€11wk0HMgHYGHWOLunhpxXA@mail.gmail.com>
Subject: Re: [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent
To: Arnd Bergmann <arnd@arndb.de>
Cc: Jani Nikula <jani.nikula@linux.intel.com>, Arnd Bergmann <arnd@kernel.org>, 
	linux-kbuild@vger.kernel.org, Harry Wentland <harry.wentland@amd.com>, 
	Alex Deucher <alexander.deucher@amd.com>, =TF-8?Q?Christian_König?=hristian.koenig@amd.com>, 
	Lucas De Marchi <lucas.demarchi@intel.com>, Oded Gabbay <ogabbay@kernel.org>, 
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, 
	Thomas Zimmermann <tzimmermann@suse.de>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, 
	Andrew Jeffery <andrew@codeconstruct.com.au>, Linus Walleij <linus.walleij@linaro.org>, 
	Joel Stanley <joel@jms.id.au>, Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, 
	Andrew Morton <akpm@linux-foundation.org>, Nathan Chancellor <nathan@kernel.org>, 
	Nicolas Schier <nicolas@fjasle.eu>, dri-devel@lists.freedesktop.org, 
	linux-kernel@vger.kernel.org, Netdev <netdev@vger.kernel.org>, linux-mm@kvack.org, 
	llvm@lists.linux.dev
Content-Type: text/plain; charset=TF-8"
Content-Transfer-Encoding: quoted-printable
Return-Path: linux-kernel+bounces-125929-steffen.klassert=cunet.com@vger.kernel.org
X-MS-Exchange-Organization-OriginalArrivalTime: 31 Mar 2024 02:34:25.4166
 (UTC)
X-MS-Exchange-Organization-Network-Message-Id: 95989cb8-1654-4156-ee8e-08dc512b14cc
X-MS-Exchange-Organization-OriginalClientIPAddress: 62.96.220.36
X-MS-Exchange-Organization-OriginalServerIPAddress: 10.53.40.201
X-MS-Exchange-Organization-Cross-Premises-Headers-Processed: cas-essen-01.secunet.de
X-MS-Exchange-Organization-OrderedPrecisionLatencyInProgress: LSRV=x-essen-02.secunet.de:TOTAL-HUB=408|SMR=329(SMRDE=004|SMRC=324(SMRCL=102|X-SMRCR=322))|CAT=078(CATOS=001
 |CATRESL=028(CATRESLP2R=022)|CATORES=046(CATRS=046(CATRS-Transport
 Rule Agent=001 |CATRS-Index Routing Agent=044)));2024-03-31T02:34:25.941Z
X-MS-Exchange-Forest-ArrivalHubServer: mbx-essen-02.secunet.de
X-MS-Exchange-Organization-AuthSource: cas-essen-01.secunet.de
X-MS-Exchange-Organization-AuthAs: Anonymous
X-MS-Exchange-Organization-FromEntityHeader: Internet
X-MS-Exchange-Organization-OriginalSize: 9587
X-MS-Exchange-Organization-HygienePolicy: Standard
X-MS-Exchange-Organization-MessageLatency: SRVÊs-essen-01.secunet.de:TOTAL-FE=117|SMR=022(SMRPI=020(SMRPI-FrontendProxyAgent=019))|SMS=094
X-MS-Exchange-Organization-Recipient-Limit-Verified: True
X-MS-Exchange-Organization-TotalRecipientCount: 1
X-MS-Exchange-Organization-Rules-Execution-History: 0b0cf904-14ac-4724-8bdf-482ee6223cf2%%%fd34672d-751c-45ae-a963-ed177fcabe23%%%d8080257-b0c3-47b4-b0db-23bc0c8ddb3c%%%95e591a2-5d7d-4afa-b1d0-7573d6c0a5d9%%%f7d0f6bc-4dcc-4876-8c5d-b3d6ddbb3d55%%%16355082-c50b-4214-9c7d-d39575f9f79b
X-MS-Exchange-Forest-RulesExecuted: mbx-essen-02
X-MS-Exchange-Organization-RulesExecuted: mbx-essen-02
X-MS-Exchange-Forest-IndexAgent-0: AQ0CZW4AAX0EAAAPAAADH4sIAAAAAAAEAI1UTW8bNxClvmXZjuEGuU
 99cQJItuM0TmIURpMcCgdwW7QGgp4Mapdasdolt1xuFN36j/p7eu0v
 6eNwJduADVQiVlxy5r03b0j9s/2zoc8qHdOVdHT6ZkynJ6ffkfR0dn
 766t+//v7lit47k9IH5bJCGkPfS7z+EB7To1Rd0NJZr853RxcY9BDY
 OKCdvD1/fTKmT9Jo+kkv6lzeJhLnXdcK8WcxldMO7hEfPM5MF7cInH
 52h/n05XmYPcJ88Qj3QzUvlDMqP7Iuu8/dKLj0tLRuUZGxy6N7O9dz
 RdbpTBuZ081NqmV2ozNjnbqRef78BVmTryjVKWlPM+soS5LJW5KQIK
 f2i2pgpiqRdaXIz1HWUlakjfYaCCsySqUqJW+pqsvSqapCgDPaZBWH
 NwiZ9STTEKlNhPmiXKWtGdO09ljRFQPLfClX+KFCV14u1P1yzt6+m5
 68eyNPzqaSnh8ktih1rtwEqs/ptzX/5DOSKyiYlPDK+lWpqgagkcal
 Qj5rts5D1o8fPx68oEKmKlgR7KTEOqcSn6+iiOa8zMdkdKK+Dd4aug
 zSzYKW6jClXC9UcCKzNJXJIkwf8lybCKXfvXzNVn9VdxlCz1I9mxEs
 maocLaXLw4Jm2ihaaj+nla2p+rOW1TyUArXgwZqjUvoE8lCbnkWsEL
 qUxlPBwnztTEjQBi+SYE+pmjS2JIRjp9QQX5ehVQE3QlXKaVWNuXmH
 VZTjrT2iT3XlKVfMsWhOYEhZW3MJZ9CYGZiAvVCqpGLVkFa6KNFAJv
 eou7CFglqYEhAy5eNZKXAdwiGbO1tnc45cTGudY8kpXCCUJHOnZLoC
 RZ3MY7+hDg014MploqpwJa1J1EYfcOUKFmN434iIPv0RSkrhDlOlTo
 fDepyV9TF0O8CwvbdVsP+USBMz+RFO75223BUfklNXsHg0l2Tia75M
 c/lFoS9wRefybmOCDFmkUNCo4fqCNZdMWykcIz1jGfEUhgtlS48b1p
 S3Ljt8wn8Mv8bv+7LMdbzEuTb110k093imv6oKeddzaRZhsjuaTHZH
 HxTK+1Vl0qXw+UpWcq6dpd8lbo8MQUK0Racjep2W2MEQ3bbodkWv3e
 oMhBiIIeZDMeq2xK7o9UQfuz2x+1BKHym9lugJjAGy+mLQEzsxst0S
 2xhhjsgBY27/X8x7gE8eAuxvRO5xWCfAPkUkwDtiHzHD1ta+aHeb3R
 DfCRQhHYy9FlJFS7Q7QclOrBrzLTFCPMKGYgujK7Y5AII7CBiILWYP
 kQhD+kA82xF7w6AfW0ES5k/F1kjsAzNwMWYUEEG2xLP2ugQg9HgSd2
 MAHLirvL3W1hZPIjuXOYjzjexNeo/1t5n9Hiw/wciu9qO2zRZPUPuw
 z8531si8vhN1xqo3KVjZ1MhSG0mYx3WGCtbhdcBOxt2IGXuBJ+d2Nz
 ojLyNEW/qRq+nduuo41hoidR86uWs9bs1wUyYo+jgtvL6xZQPFu990
 xR5SAlfoZp9dght7se+A7f8HnaT+4RQJAAABCrECPD94bWwgdmVyc2
 lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTE2Ij8+DQo8RW1haWxTZXQ+
 DQogIDxWZXJzaW9uPjE1LjAuMC4wPC9WZXJzaW9uPg0KICA8RW1haW
 xzPg0KICAgIDxFbWFpbCBTdGFydEluZGV4PSI0NyI+DQogICAgICA8
 RW1haWxTdHJpbmc+YXJuZEBhcm5kYi5kZTwvRW1haWxTdHJpbmc+DQ
 ogICAgPC9FbWFpbD4NCiAgICA8RW1haWwgU3RhcnRJbmRleD0iMjkx
 Ij4NCiAgICAgIDxFbWFpbFN0cmluZz5hcm5kQGtlcm5lbC5vcmc8L0
 VtYWlsU3RyaW5nPg0KICAgIDwvRW1haWw+DQogIDwvRW1haWxzPg0K
 PC9FbWFpbFNldD4BDLEJPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZG
 luZz0idXRmLTE2Ij8+DQo8Q29udGFjdFNldD4NCiAgPFZlcnNpb24+
 MTUuMC4wLjA8L1ZlcnNpb24+DQogIDxDb250YWN0cz4NCiAgICA8Q2
 9udGFjdCBTdGFydEluZGV4PSIzMiI+DQogICAgICA8UGVyc29uIFN0
 YXJ0SW5kZXg9IjMyIj4NCiAgICAgICAgPFBlcnNvblN0cmluZz5Bcm
 5kIEJlcmdtYW5uPC9QZXJzb25TdHJpbmc+DQogICAgICA8L1BlcnNv
 bj4NCiAgICAgIDxFbWFpbHM+DQogICAgICAgIDxFbWFpbCBTdGFydE
 luZGV4PSI0NyI+DQogICAgICAgICAgPEVtYWlsU3RyaW5nPmFybmRA
 YXJuZGIuZGU8L0VtYWlsU3RyaW5nPg0KICAgICAgICA8L0VtYWlsPg
 0KICAgICAgPC9FbWFpbHM+DQogICAgICA8Q29udGFjdFN0cmluZz5B
 cm5kIEJlcmdtYW5uICZsdDthcm5kQGFybmRiLmRlPC9Db250YWN0U3
 RyaW5nPg0KICAgIDwvQ29udGFjdD4NCiAgICA8Q29udGFjdCBTdGFy
 dEluZGV4PSIxNTMiPg0KICAgICAgPFBlcnNvbiBTdGFydEluZGV4PS
 IxNTMiPg0KICAgICAgICA8UGVyc29uU3RyaW5nPkFybmQgQmVyZ21h
 bm48L1BlcnNvblN0cmluZz4NCiAgICAgIDwvUGVyc29uPg0KICAgIC
 AgPEVtYWlscz4NCiAgICAgICAgPEVtYWlsIFN0YXJ0SW5kZXg9IjE2
 OSI+DQogICAgICAgICAgPEVtYWlsU3RyaW5nPmFybmRAYXJuZGIuZG
 U8L0VtYWlsU3RyaW5nPg0KICAgICAgICA8L0VtYWlsPg0KICAgICAg
 PC9FbWFpbHM+DQogICAgICA8Q29udGFjdFN0cmluZz5Bcm5kIEJlcm
 dtYW5uIiAmbHQ7YXJuZEBhcm5kYi5kZTwvQ29udGFjdFN0cmluZz4N
 CiAgICA8L0NvbnRhY3Q+DQogICAgPENvbnRhY3QgU3RhcnRJbmRleD
 0iMjc2Ij4NCiAgICAgIDxQZXJzb24gU3RhcnRJbmRleD0iMjc2Ij4N
 CiAgICAgICAgPFBlcnNvblN0cmluZz5Bcm5kIEJlcmdtYW5uPC9QZX
 Jzb25TdHJpbmc+DQogICAgICA8L1BlcnNvbj4NCiAgICAgIDxFbWFp
 bHM+DQogICAgICAgIDxFbWFpbCBTdGFydEluZGV4PSIyOTEiPg0KIC
 AgICAgICAgIDxFbWFpbFN0cmluZz5hcm5kQGtlcm5lbC5vcmc8L0Vt
 YWlsU3RyaW5nPg0KICAgICAgICA8L0VtYWlsPg0KICAgICAgPC9FbW
 FpbHM+DQogICAgICA8Q29udGFjdFN0cmluZz5Bcm5kIEJlcmdtYW5u
 ICZsdDthcm5kQGtlcm5lbC5vcmc8L0NvbnRhY3RTdHJpbmc+DQogIC
 AgPC9Db250YWN0Pg0KICA8L0NvbnRhY3RzPg0KPC9Db250YWN0U2V0
 PgEOzwFSZXRyaWV2ZXJPcGVyYXRvciwxMCwxO1JldHJpZXZlck9wZX
 JhdG9yLDExLDI7UG9zdERvY1BhcnNlck9wZXJhdG9yLDEwLDE7UG9z
 dERvY1BhcnNlck9wZXJhdG9yLDExLDA7UG9zdFdvcmRCcmVha2VyRG
 lhZ25vc3RpY09wZXJhdG9yLDEwLDI7UG9zdFdvcmRCcmVha2VyRGlh
 Z25vc3RpY09wZXJhdG9yLDExLDA7VHJhbnNwb3J0V3JpdGVyUHJvZH VjZXIsMjAsMjIX-MS-Exchange-Forest-IndexAgent: 1 2885
X-MS-Exchange-Forest-EmailMessageHash: 121D0850
X-MS-Exchange-Forest-Language: en
X-MS-Exchange-Organization-Processed-By-Journaling: Journal Agent

On Wed, Mar 27, 2024 at 6:23 PM Arnd Bergmann <arnd@arndb.de> wrote:
>
> On Wed, Mar 27, 2024, at 08:50, Jani Nikula wrote:
> > On Tue, 26 Mar 2024, "Arnd Bergmann" <arnd@arndb.de> wrote:
> >> On Tue, Mar 26, 2024, at 21:24, Jani Nikula wrote:
> >>> On Tue, 26 Mar 2024, Arnd Bergmann <arnd@kernel.org> wrote:
> >>
> >> It works now.
> >>
> >> The original __diag_ignore_all() only did it for gcc-8 and above
> >> because that was initially needed to suppress warnings that
> >> got added in that version, but this was always a mistake.
> >>
> >> 689b097a06ba ("compiler-gcc: Suppress -Wmissing-prototypes
> >> warning for all supported GCC") made it work correctly.
> >
> > Oh, nice! Then I think we'd like to go back to __diag_ignore_all() in
> > i915 and xe.
> >
> > The diff is below. I'm fine with you squashing it to your patch, or if
> > you want me to turn it into a proper patch for you to pick up in your
> > series, that's fine too. Just let me know.
>
> I think I'd prefer to keep my patch simpler for the moment and
> get that merged through the kbuild tree, it already touches
> too many places at once.
>
> It may be better for me to just drop the drivers/gpu/ part of
> my patch so you can just just take your patch through the
> drm tree. I actually have a similar patch for the amdgpu driver
> that I can send if you like this option better.
>
>     Arnd
>



Applied to linux-kbuild/fixes.
Thanks.

-- 
Best Regards
Masahiro Yamada


^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 05/12] firmware: dmi-id: add a release callback function
  2024-03-29 12:49   ` Jean Delvare
  2024-03-29 16:12     ` Nathan Chancellor
@ 2024-04-04 14:07     ` Arnd Bergmann
  2024-04-08  7:59       ` Jean Delvare
  1 sibling, 1 reply; 36+ messages in thread
From: Arnd Bergmann @ 2024-04-04 14:07 UTC (permalink / raw)
  To: Jean Delvare, Arnd Bergmann
  Cc: linux-kbuild, Masahiro Yamada, Nathan Chancellor,
	Greg Kroah-Hartman, Nicolas Schier, Nick Desaulniers,
	Bill Wendling, Justin Stitt, linux-kernel, llvm

On Fri, Mar 29, 2024, at 13:49, Jean Delvare wrote:
> On Tue, 26 Mar 2024 15:51:30 +0100, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>> 
>> dmi_class uses kfree() as the .release function, but that now causes
>> a warning with clang-16 as it violates control flow integrity (KCFI)
>> rules:
>> 
>> drivers/firmware/dmi-id.c:174:17: error: cast from 'void (*)(const void *)' to 'void (*)(struct device *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
>>   174 |         .dev_release = (void(*)(struct device *)) kfree,
>> 
>> Add an explicit function to call kfree() instead.
>> 
>> Fixes: 4f5c791a850e ("DMI-based module autoloading")
>
> Not sure if this fixes tag is really warranted. As I understand it,
> your change only removes a warning but there was no actual bug, right?

As Nathan already commented, it's a real bug. I also add 'Fixes'
tags for false-positives just to document what introduced a
warning. The Fixes tag doesn't automatically mean something gets
backported, though the stable maintainers often end up backporting
warning fixes as well, and it helps identify which kernels
need it.

> Looks good to me, thanks for doing that.
>
> Signed-off-by: Jean Delvare <jdelvare@suse.de>
>
> Will you get this upstream, or do you expect me to take it in my
> dmi/for-next branch?

It would help me if you can apply it to your tree directly.

     Arnd

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 05/12] firmware: dmi-id: add a release callback function
  2024-04-04 14:07     ` Arnd Bergmann
@ 2024-04-08  7:59       ` Jean Delvare
  2024-04-12  9:42         ` Arnd Bergmann
  0 siblings, 1 reply; 36+ messages in thread
From: Jean Delvare @ 2024-04-08  7:59 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Arnd Bergmann, linux-kbuild, Masahiro Yamada, Nathan Chancellor,
	Greg Kroah-Hartman, Nicolas Schier, Nick Desaulniers,
	Bill Wendling, Justin Stitt, linux-kernel, llvm

Hi Arnd,

On Thu, 04 Apr 2024 16:07:55 +0200, Arnd Bergmann wrote:
> On Fri, Mar 29, 2024, at 13:49, Jean Delvare wrote:
> > Will you get this upstream, or do you expect me to take it in my
> > dmi/for-next branch?  
> 
> It would help me if you can apply it to your tree directly.

OK, it's in my dmi-for-next branch now:

https://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging.git/log/?h=dmi-for-next

Thanks,
-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 05/12] firmware: dmi-id: add a release callback function
  2024-04-08  7:59       ` Jean Delvare
@ 2024-04-12  9:42         ` Arnd Bergmann
  2024-04-13 20:38           ` Jean Delvare
  0 siblings, 1 reply; 36+ messages in thread
From: Arnd Bergmann @ 2024-04-12  9:42 UTC (permalink / raw)
  To: Jean Delvare
  Cc: Arnd Bergmann, linux-kbuild, Masahiro Yamada, Nathan Chancellor,
	Greg Kroah-Hartman, Nicolas Schier, Nick Desaulniers,
	Bill Wendling, Justin Stitt, linux-kernel, llvm,
	Stephen Rothwell, Andrew Morton

On Mon, Apr 8, 2024, at 09:59, Jean Delvare wrote:
> On Thu, 04 Apr 2024 16:07:55 +0200, Arnd Bergmann wrote:
>> On Fri, Mar 29, 2024, at 13:49, Jean Delvare wrote:
>> > Will you get this upstream, or do you expect me to take it in my
>> > dmi/for-next branch?  
>> 
>> It would help me if you can apply it to your tree directly.
>
> OK, it's in my dmi-for-next branch now:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging.git/log/?h=dmi-for-next

Hi Jean,

I see it's in your tree, but I don't see your tree in linux-next.

As all the other fixes from my series got merged, I would like to
merge the patches that turn the warnings on, but that still
causes a build-time regression.

Is there a reason for the dmi-next tree not being part of
linux-next, or should we ask Stephen (added to Cc) to add it?

     Arnd

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 05/12] firmware: dmi-id: add a release callback function
  2024-04-12  9:42         ` Arnd Bergmann
@ 2024-04-13 20:38           ` Jean Delvare
  2024-04-14 22:18             ` Stephen Rothwell
  0 siblings, 1 reply; 36+ messages in thread
From: Jean Delvare @ 2024-04-13 20:38 UTC (permalink / raw)
  To: Arnd Bergmann, Stephen Rothwell
  Cc: Arnd Bergmann, linux-kbuild, Masahiro Yamada, Nathan Chancellor,
	Greg Kroah-Hartman, Nicolas Schier, Nick Desaulniers,
	Bill Wendling, Justin Stitt, linux-kernel, llvm, Andrew Morton

On Fri, 12 Apr 2024 11:42:03 +0200, Arnd Bergmann wrote:
> On Mon, Apr 8, 2024, at 09:59, Jean Delvare wrote:
> > On Thu, 04 Apr 2024 16:07:55 +0200, Arnd Bergmann wrote:  
> >> On Fri, Mar 29, 2024, at 13:49, Jean Delvare wrote:  
> >> > Will you get this upstream, or do you expect me to take it in my
> >> > dmi/for-next branch?    
> >> 
> >> It would help me if you can apply it to your tree directly.  
> >
> > OK, it's in my dmi-for-next branch now:
> >
> > https://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging.git/log/?h=dmi-for-next  
> 
> I see it's in your tree, but I don't see your tree in linux-next.
>
> As all the other fixes from my series got merged, I would like to
> merge the patches that turn the warnings on, but that still
> causes a build-time regression.
> 
> Is there a reason for the dmi-next tree not being part of
> linux-next, or should we ask Stephen (added to Cc) to add it?

Hmm, Stephen cleaned up the list of trees he pulls from 2 months ago.
Back then, I objected that I may use my tree again in the future, and I
thought he had added it back to the list, but maybe I misunderstood.

Stephen, can you check if you still pull from tree above, and if not,
add it back to the list? Thanks in advance.

-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 05/12] firmware: dmi-id: add a release callback function
  2024-04-13 20:38           ` Jean Delvare
@ 2024-04-14 22:18             ` Stephen Rothwell
  0 siblings, 0 replies; 36+ messages in thread
From: Stephen Rothwell @ 2024-04-14 22:18 UTC (permalink / raw)
  To: Jean Delvare
  Cc: Arnd Bergmann, Stephen Rothwell, Arnd Bergmann, linux-kbuild,
	Masahiro Yamada, Nathan Chancellor, Greg Kroah-Hartman,
	Nicolas Schier, Nick Desaulniers, Bill Wendling, Justin Stitt,
	linux-kernel, llvm, Andrew Morton

[-- Attachment #1: Type: text/plain, Size: 569 bytes --]

Hi Jean,

On Sat, 13 Apr 2024 22:38:57 +0200 Jean Delvare <jdelvare@suse.de> wrote:
>
> Hmm, Stephen cleaned up the list of trees he pulls from 2 months ago.
> Back then, I objected that I may use my tree again in the future, and I
> thought he had added it back to the list, but maybe I misunderstood.
> 
> Stephen, can you check if you still pull from tree above, and if not,
> add it back to the list? Thanks in advance.

I also misunderstood your position at the time.  I have now restored
the dmi tree to linux-next.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2024-04-14 22:26 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-26 14:47 [PATCH 00/12] kbuild: enable some -Wextra warnings by default Arnd Bergmann
2024-03-26 14:47 ` [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent Arnd Bergmann
2024-03-26 16:04   ` Hamza Mahfooz
2024-03-26 20:24   ` Jani Nikula
2024-03-26 20:55     ` Arnd Bergmann
2024-03-27  7:50       ` Jani Nikula
2024-03-27  9:22         ` Arnd Bergmann
2024-03-31  2:33           ` Masahiro Yamada
2024-03-31  2:33             ` Masahiro Yamada
2024-03-26 23:02   ` Andrew Jeffery
2024-03-28  9:18   ` Linus Walleij
2024-03-26 14:51 ` [PATCH 02/12] [v3] parport: mfc3: avoid empty-body warning Arnd Bergmann
2024-03-26 14:51 ` [PATCH 03/12] kbuild: turn on -Wextra by default Arnd Bergmann
2024-03-26 14:51 ` [PATCH 04/12] kbuild: remove redundant extra warning flags Arnd Bergmann
2024-03-26 14:51 ` [PATCH 05/12] firmware: dmi-id: add a release callback function Arnd Bergmann
2024-03-29 12:49   ` Jean Delvare
2024-03-29 16:12     ` Nathan Chancellor
2024-04-04 14:07     ` Arnd Bergmann
2024-04-08  7:59       ` Jean Delvare
2024-04-12  9:42         ` Arnd Bergmann
2024-04-13 20:38           ` Jean Delvare
2024-04-14 22:18             ` Stephen Rothwell
2024-03-26 14:51 ` [PATCH 06/12] nouveau: fix function cast warning Arnd Bergmann
2024-03-26 15:20   ` Timur Tabi
2024-03-26 16:02     ` Arnd Bergmann
2024-03-26 14:51 ` [PATCH 07/12] cxlflash: fix function pointer cast warnings Arnd Bergmann
2024-03-26 14:51 ` [PATCH 08/12] x86: math-emu: fix function " Arnd Bergmann
2024-03-26 14:51 ` [PATCH 09/12] kbuild: enable -Wcast-function-type-strict unconditionally Arnd Bergmann
2024-03-26 14:53 ` [PATCH 10/12] sata: sx4: fix pdc20621_get_from_dimm() on 64-bit Arnd Bergmann
2024-03-27  1:36   ` Damien Le Moal
2024-03-27 20:21     ` Arnd Bergmann
2024-03-28  0:14       ` Damien Le Moal
2024-03-26 14:53 ` [PATCH 11/12] [v4] kallsyms: rework symbol lookup return codes Arnd Bergmann
2024-03-26 17:06   ` Steven Rostedt
2024-03-26 17:10     ` Arnd Bergmann
2024-03-26 14:53 ` [PATCH 12/12] kbuild: turn on -Wrestrict by default Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).