Subject: Re: linux-next: build warning after merge of the kspp-gustavo tree

From: "Gustavo A. R. Silva" <[email-masked]>
Date: Tue, 21 Nov 2023 17:07:32 -0600

On 11/21/23 16:47, Stephen Rothwell wrote:
> Hi all,
> 
> After merging the kspp-gustavo tree, today's linux-next build (x86_64
> allmodconfig) produced this warning:
> 
> In file included from include/linux/string.h:295,
>                   from include/linux/bitmap.h:12,
>                   from include/linux/cpumask.h:12,
>                   from arch/x86/include/asm/paravirt.h:17,
>                   from arch/x86/include/asm/cpuid.h:62,
>                   from arch/x86/include/asm/processor.h:19,
>                   from arch/x86/include/asm/cpufeature.h:5,
>                   from arch/x86/include/asm/thread_info.h:53,
>                   from include/linux/thread_info.h:60,
>                   from arch/x86/include/asm/preempt.h:9,
>                   from include/linux/preempt.h:79,
>                   from include/linux/spinlock.h:56,
>                   from include/linux/mmzone.h:8,
>                   from include/linux/gfp.h:7,
>                   from include/linux/firmware.h:7,
>                   from drivers/net/wireless/realtek/rtw89/core.h:10,
>                   from drivers/net/wireless/realtek/rtw89/coex.h:8,
>                   from drivers/net/wireless/realtek/rtw89/coex.c:5:
> drivers/net/wireless/realtek/rtw89/coex.c: In function '_append_tdma':
> include/linux/fortify-string.h:57:33: warning: writing 8 bytes into a region of size 0 [-Wstringop-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/net/wireless/realtek/rtw89/coex.c:1585:17: note: in expansion of macro 'memcpy'
>   1585 |                 memcpy(&v3->tdma, &dm->tdma, sizeof(v3->tdma));
>        |                 ^~~~~~
> drivers/net/wireless/realtek/rtw89/core.h:2703:37: note: at offset [5714, 71249] into destination object 'ver' of size 8
>   2703 |         const struct rtw89_btc_ver *ver;
>        |                                     ^~~
> include/linux/fortify-string.h:57:33: warning: writing 8 bytes into a region of size 0 [-Wstringop-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/net/wireless/realtek/rtw89/coex.c:1579:17: note: in expansion of macro 'memcpy'
>   1579 |                 memcpy(v, &dm->tdma, sizeof(*v));
>        |                 ^~~~~~
> drivers/net/wireless/realtek/rtw89/core.h:2703:37: note: at offset [5710, 71245] into destination object 'ver' of size 8
>   2703 |         const struct rtw89_btc_ver *ver;
>        |                                     ^~~
> 
> Exposed by commit
> 
>    1b56c90018f0 ("Makefile: Enable -Wstringop-overflow globally")
> 
> This is with your tree on top of Linus' tree (and some fix patches but
> nothing that obviously touches anything relevent) and CONFIG_WERROR
> not set.

Stephen,

The fix for that shows up in linux-next already:

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=ca76817f4c4bbf8f98268772f4eeea8382a34bcd

Thanks for your help on this. :)
--
Gustavo