Re: [BUG] allmodconfig build error in next-20240108

From: Paul E. McKenney
Date: Wed Jan 10 2024 - 05:30:11 EST


On Wed, Jan 10, 2024 at 04:03:51PM +1100, Stephen Rothwell wrote:
> Hi Paul,
>
> On Tue, 9 Jan 2024 19:46:27 -0800 "Paul E. McKenney" <paulmck@xxxxxxxxxx> wrote:
> >
> > On Wed, Jan 10, 2024 at 09:58:22AM +1100, Stephen Rothwell wrote:
> > >
> > > Maybe that line "subdir-ccflags-y += $(call cc-option, -Wstringop-overflow)"
> > > should just be removed as the setting of that option has been moved to the
> > > normal C flags in the top level Makefile (out of Makefile.extrawarn).
> >
> > If you meant like this, no joy. :-(
>
> Actually I meant the one in drivers/gpu/drm/xe/Makefile

Like this? That does work as shown below, thank you!

Thanx, Paul

------------------------------------------------------------------------

drm/xe: Fix build bug for GCC 11

Building drivers/gpu/drm/xe/xe_gt_pagefault.c with GCC 11 results
in the following build errors:

/include/linux/fortify-string.h:57:33: error: writing 16 bytes into a region of size 0 [-Werror=stringop-overflow=]
57 | #define __underlying_memcpy __builtin_memcpy
| ^
/include/linux/fortify-string.h:644:9: note: in expansion of macro ‘__underlying_memcpy’
644 | __underlying_##op(p, q, __fortify_size); \
| ^~~~~~~~~~~~~
/include/linux/fortify-string.h:689:26: note: in expansion of macro ‘__fortify_memcpy_chk’
689 | #define memcpy(p, q, s) __fortify_memcpy_chk(p, q, s, \
| ^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/xe/xe_gt_pagefault.c:340:17: note: in expansion of macro ‘memcpy’
340 | memcpy(pf_queue->data + pf_queue->tail, msg, len * sizeof(u32));
| ^~~~~~
In file included from drivers/gpu/drm/xe/xe_device_types.h:17,
from drivers/gpu/drm/xe/xe_vm_types.h:16,
from drivers/gpu/drm/xe/xe_bo.h:13,
from drivers/gpu/drm/xe/xe_gt_pagefault.c:16:
drivers/gpu/drm/xe/xe_gt_types.h:102:25: note: at offset [1144, 265324] into destination object ‘tile’ of size 8
102 | struct xe_tile *tile;
| ^~~~

Fix these by removing -Wstringop-overflow from drm/xe builds.

Suggested-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxx>
Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile
index 53bd2a8ba1ae..efcf0ab7a1a6 100644
--- a/drivers/gpu/drm/xe/Makefile
+++ b/drivers/gpu/drm/xe/Makefile
@@ -17,7 +17,6 @@ subdir-ccflags-y += $(call cc-option, -Wunused-const-variable)
subdir-ccflags-y += $(call cc-option, -Wpacked-not-aligned)
subdir-ccflags-y += $(call cc-option, -Wformat-overflow)
subdir-ccflags-y += $(call cc-option, -Wformat-truncation)
-subdir-ccflags-y += $(call cc-option, -Wstringop-overflow)
subdir-ccflags-y += $(call cc-option, -Wstringop-truncation)
# The following turn off the warnings enabled by -Wextra
ifeq ($(findstring 2, $(KBUILD_EXTRA_WARN)),)