On Mon, 10. Mar 15:23, Kees Cook wrote: > When a character array without a terminating NUL character has a static > initializer, GCC 15's -Wunterminated-string-initialization will only > warn if the array lacks the "nonstring" attribute[1]. Mark the arrays > with __nonstring to and correctly identify the char array as "not a C > string" and thereby eliminate the warning. > > Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117178 [1] > Cc: Zhenyu Wang <zhen...@linux.intel.com> > Cc: Zhi Wang <zhi.wang.li...@gmail.com> > Cc: Jani Nikula <jani.nik...@linux.intel.com> > Cc: Joonas Lahtinen <joonas.lahti...@linux.intel.com> > Cc: Rodrigo Vivi <rodrigo.v...@intel.com> > Cc: Tvrtko Ursulin <tursu...@ursulin.net> > Cc: David Airlie <airl...@gmail.com> > Cc: Simona Vetter <sim...@ffwll.ch> > Cc: intel-gvt-...@lists.freedesktop.org > Cc: intel-...@lists.freedesktop.org > Cc: dri-devel@lists.freedesktop.org > Signed-off-by: Kees Cook <k...@kernel.org> > --- > drivers/gpu/drm/i915/gvt/opregion.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gvt/opregion.c > b/drivers/gpu/drm/i915/gvt/opregion.c > index 509f9ccae3a9..f701638d3145 100644 > --- a/drivers/gpu/drm/i915/gvt/opregion.c > +++ b/drivers/gpu/drm/i915/gvt/opregion.c > @@ -43,7 +43,7 @@ > #define DEVICE_TYPE_EFP4 0x10 > > struct opregion_header { > - u8 signature[16]; > + u8 signature[16] __nonstring; > u32 size; > u32 opregion_ver; > u8 bios_ver[32]; > @@ -222,7 +222,7 @@ int intel_vgpu_init_opregion(struct intel_vgpu *vgpu) > u8 *buf; > struct opregion_header *header; > struct vbt v; > - const char opregion_signature[16] = OPREGION_SIGNATURE; > + const char opregion_signature[16] __nonstring = OPREGION_SIGNATURE; > > gvt_dbg_core("init vgpu%d opregion\n", vgpu->id); > vgpu_opregion(vgpu)->va = (void *)__get_free_pages(GFP_KERNEL | > -- > 2.34.1 > Hello together,
it doesnt resolve the build issue with gcc15 gcc (GCC) 15.0.1 20250228 CC [M] drivers/gpu/drm/i915/gvt/scheduler.o /home/damian/kernel/linux/drivers/gpu/drm/i915/gvt/opregion.c: In function ‘intel_vgpu_init_opregion’: /home/damian/kernel/linux/drivers/gpu/drm/i915/gvt/opregion.c:35:28: error: initializer-string for array of ‘char’ is too long [-Werror=unterminated-string-initialization] 35 | #define OPREGION_SIGNATURE "IntelGraphicsMem" | ^~~~~~~~~~~~~~~~~~ /home/damian/kernel/linux/drivers/gpu/drm/i915/gvt/opregion.c:225:57: note: in expansion of macro ‘OPREGION_SIGNATURE’ 225 | const char opregion_signature[16] __nonstring = OPREGION_SIGNATURE; | ^~~~~~~~~~~~~~~~~~ CC [M] drivers/gpu/drm/i915/gvt/trace_points.o cc1: all warnings being treated as errors make[7]: *** [/home/damian/kernel/linux/scripts/Makefile.build:207: drivers/gpu/drm/i915/gvt/opregion.o] Error 1 make[7]: *** Waiting for unfinished jobs.... CC [M] drivers/gpu/drm/i915/gvt/vgpu.o make[6]: *** [/home/damian/kernel/linux/scripts/Makefile.build:465: drivers/gpu/drm/i915] Error 2 make[5]: *** [/home/damian/kernel/linux/s -- VG Damian Tometzki