2023-11-22 03:48:34

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: build warnings after merge of the kspp-gustavo tree

Hi all,

After merging the kspp-gustavo tree, today's linux-next build (sparc64
defconfig) produced these warnings:

mm/mempolicy.c: In function 'mpol_parse_str':
mm/mempolicy.c:3007:26: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
3007 | *--flags = '=';
| ~~~~~~~~~^~~~~
mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
2890 | int mpol_parse_str(char *str, struct mempolicy **mpol)
| ~~~~~~^~~
mm/mempolicy.c:3007:26: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
3007 | *--flags = '=';
| ~~~~~~~~~^~~~~
mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
2890 | int mpol_parse_str(char *str, struct mempolicy **mpol)
| ~~~~~~^~~
mm/mempolicy.c:3007:26: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
3007 | *--flags = '=';
| ~~~~~~~~~^~~~~
mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
2890 | int mpol_parse_str(char *str, struct mempolicy **mpol)
| ~~~~~~^~~
mm/mempolicy.c:3007:26: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
3007 | *--flags = '=';
| ~~~~~~~~~^~~~~
mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
2890 | int mpol_parse_str(char *str, struct mempolicy **mpol)
| ~~~~~~^~~
mm/mempolicy.c:3005:29: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
3005 | *--nodelist = ':';
| ~~~~~~~~~~~~^~~~~
mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
2890 | int mpol_parse_str(char *str, struct mempolicy **mpol)
| ~~~~~~^~~
mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
mm/mempolicy.c:3007:26: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
3007 | *--flags = '=';
| ~~~~~~~~~^~~~~
mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
2890 | int mpol_parse_str(char *str, struct mempolicy **mpol)
| ~~~~~~^~~
mm/mempolicy.c:3005:29: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
3005 | *--nodelist = ':';
| ~~~~~~~~~~~~^~~~~
mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
2890 | int mpol_parse_str(char *str, struct mempolicy **mpol)
| ~~~~~~^~~
mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
mm/mempolicy.c:3007:26: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
3007 | *--flags = '=';
| ~~~~~~~~~^~~~~
mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
2890 | int mpol_parse_str(char *str, struct mempolicy **mpol)
| ~~~~~~^~~

This is using gcc v11.1.0

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2023-11-22 04:04:43

by Gustavo A. R. Silva

[permalink] [raw]
Subject: Re: linux-next: build warnings after merge of the kspp-gustavo tree



On 11/21/23 21:48, Stephen Rothwell wrote:
> Hi all,
>
> After merging the kspp-gustavo tree, today's linux-next build (sparc64
> defconfig) produced these warnings:
>

[..]

> mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
> mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
> mm/mempolicy.c:3007:26: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
> 3007 | *--flags = '=';
> | ~~~~~~~~~^~~~~
> mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
> 2890 | int mpol_parse_str(char *str, struct mempolicy **mpol)
> | ~~~~~~^~~
>
> This is using gcc v11.1.0
>

This doesn't show up with more recent compilers because it was an issue in GCC.

--
Gustavo

2023-11-22 04:52:56

by Aithal, Srikanth

[permalink] [raw]
Subject: Re: linux-next: build warnings after merge of the kspp-gustavo tree

On 11/22/2023 9:18 AM, Stephen Rothwell wrote:
> Hi all,
>
> After merging the kspp-gustavo tree, today's linux-next build (sparc64
> defconfig) produced these warnings:
>
> mm/mempolicy.c: In function 'mpol_parse_str':
> mm/mempolicy.c:3007:26: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
> 3007 | *--flags = '=';
> | ~~~~~~~~~^~~~~
> mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
> 2890 | int mpol_parse_str(char *str, struct mempolicy **mpol)
> | ~~~~~~^~~
> mm/mempolicy.c:3007:26: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
> 3007 | *--flags = '=';
> | ~~~~~~~~~^~~~~
> mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
> 2890 | int mpol_parse_str(char *str, struct mempolicy **mpol)
> | ~~~~~~^~~
> mm/mempolicy.c:3007:26: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
> 3007 | *--flags = '=';
> | ~~~~~~~~~^~~~~
> mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
> 2890 | int mpol_parse_str(char *str, struct mempolicy **mpol)
> | ~~~~~~^~~
> mm/mempolicy.c:3007:26: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
> 3007 | *--flags = '=';
> | ~~~~~~~~~^~~~~
> mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
> 2890 | int mpol_parse_str(char *str, struct mempolicy **mpol)
> | ~~~~~~^~~
> mm/mempolicy.c:3005:29: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
> 3005 | *--nodelist = ':';
> | ~~~~~~~~~~~~^~~~~
> mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
> 2890 | int mpol_parse_str(char *str, struct mempolicy **mpol)
> | ~~~~~~^~~
> mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
> mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
> mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
> mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
> mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
> mm/mempolicy.c:3007:26: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
> 3007 | *--flags = '=';
> | ~~~~~~~~~^~~~~
> mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
> 2890 | int mpol_parse_str(char *str, struct mempolicy **mpol)
> | ~~~~~~^~~
> mm/mempolicy.c:3005:29: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
> 3005 | *--nodelist = ':';
> | ~~~~~~~~~~~~^~~~~
> mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
> 2890 | int mpol_parse_str(char *str, struct mempolicy **mpol)
> | ~~~~~~^~~
> mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
> mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
> mm/mempolicy.c:3007:26: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
> 3007 | *--flags = '=';
> | ~~~~~~~~~^~~~~
> mm/mempolicy.c:2890:26: note: destination object 'str' of size [0, 9223372036854775807]
> 2890 | int mpol_parse_str(char *str, struct mempolicy **mpol)
> | ~~~~~~^~~
>
> This is using gcc v11.1.0
>
On AMD x86_64 platform with attached KVM guest, I am seeing build errors:

lib/vsprintf.c: In function ‘vsnprintf’:
lib/vsprintf.c:2894:33: error: writing 1 byte into a region of size 0
[-Werror=stringop-overflow=]
2894 | end[-1] = '\0';
| ~~~~~~~~^~~~~~
lib/vsprintf.c:2749:21: note: at offset [-9223372036854775808,
9223372036854775806] into destination object ‘buf’ of size [0,
9223372036854775807]
2749 | int vsnprintf(char *buf, size_t size, const char *fmt, va_list
args)
| ~~~~~~^~~
lib/vsprintf.c: In function ‘bstr_printf’:
lib/vsprintf.c:3392:33: error: writing 1 byte into a region of size 0
[-Werror=stringop-overflow=]
3392 | end[-1] = '\0';
| ~~~~~~~~^~~~~~
lib/vsprintf.c:3213:23: note: at offset [-9223372036854775808,
9223372036854775806] into destination object ‘buf’ of size [0,
9223372036854775807]
3213 | int bstr_printf(char *buf, size_t size, const char *fmt, const
u32 *bin_buf)
| ~~~~~~^~~
cc1: all warnings being treated as errors
make[3]: *** [scripts/Makefile.build:243: lib/vsprintf.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [scripts/Makefile.build:480: lib] Error 2
make[2]: *** Waiting for unfinished jobs....
mm/mempolicy.c: In function ‘mpol_parse_str’:
mm/mempolicy.c:3007:26: error: writing 1 byte into a region of size 0
[-Werror=stringop-overflow=]
3007 | *--flags = '=';
| ~~~~~~~~~^~~~~
mm/mempolicy.c:2890:26: note: destination object ‘str’ of size [0,
9223372036854775807]
2890 | int mpol_parse_str(char *str, struct mempolicy **mpol)
| ~~~~~~^~~
mm/mempolicy.c:3007:26: error: writing 1 byte into a region of size 0
[-Werror=stringop-overflow=]
3007 | *--flags = '=';
| ~~~~~~~~~^~~~~
mm/mempolicy.c:2890:26: note: destination object ‘str’ of size [0,
9223372036854775807]
2890 | int mpol_parse_str(char *str, struct mempolicy **mpol)
| ~~~~~~^~~
mm/mempolicy.c:3007:26: error: writing 1 byte into a region of size 0
[-Werror=stringop-overflow=]
3007 | *--flags = '=';
| ~~~~~~~~~^~~~~
mm/mempolicy.c:2890:26: note: destination object ‘str’ of size [0,
9223372036854775807]
2890 | int mpol_parse_str(char *str, struct mempolicy **mpol)
| ~~~~~~^~~
mm/mempolicy.c:3007:26: error: writing 1 byte into a region of size 0
[-Werror=stringop-overflow=]
3007 | *--flags = '=';
| ~~~~~~~~~^~~~~
mm/mempolicy.c:2890:26: note: destination object ‘str’ of size [0,
9223372036854775807]
2890 | int mpol_parse_str(char *str, struct mempolicy **mpol)
| ~~~~~~^~~
mm/mempolicy.c:3007:26: error: writing 1 byte into a region of size 0
[-Werror=stringop-overflow=]
3007 | *--flags = '=';
| ~~~~~~~~~^~~~~
mm/mempolicy.c:2890:26: note: destination object ‘str’ of size [0,
9223372036854775807]
2890 | int mpol_parse_str(char *str, struct mempolicy **mpol)
| ~~~~~~^~~
mm/mempolicy.c:3007:26: error: writing 1 byte into a region of size 0
[-Werror=stringop-overflow=]
3007 | *--flags = '=';
| ~~~~~~~~~^~~~~
mm/mempolicy.c:2890:26: note: destination object ‘str’ of size [0,
9223372036854775807]
2890 | int mpol_parse_str(char *str, struct mempolicy **mpol)
| ~~~~~~^~~
cc1: all warnings being treated as errors
make[3]: *** [scripts/Makefile.build:243: mm/mempolicy.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [scripts/Makefile.build:480: mm] Error 2
make[1]: *** [guest_kernel/Makefile:1914: .] Error 2
make: *** [Makefile:234: __sub-make] Error 2

@Gustavo I see you have mentioned it as gcc issue. I was not hitting
this until yesterdays linux-next build. I am on latest gcc which RHEL
9.x provides,
gcc --version
gcc (GCC) 11.4.1 20230605 (Red Hat 11.4.1-2)

which version of gcc resolves this issue?

Thanks and Regards,
Srikanth Aithal


Attachments:
guest_config (144.51 kB)

2023-11-22 05:18:46

by Stephen Rothwell

[permalink] [raw]
Subject: Re: linux-next: build warnings after merge of the kspp-gustavo tree

Hi Gustavo,

On Tue, 21 Nov 2023 22:04:17 -0600 "Gustavo A. R. Silva" <[email protected]> wrote:
>
> This doesn't show up with more recent compilers because it was an issue in GCC.

Sure, but we do still support gcc back to v5.1 .. are there other
earlier versions where you may want to suppress these warnings?

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2023-11-24 01:23:54

by Gustavo A. R. Silva

[permalink] [raw]
Subject: Re: linux-next: build warnings after merge of the kspp-gustavo tree


> which version of gcc resolves this issue?

GCC 12.1.0

--
Gustavo

2023-11-24 19:08:10

by Gustavo A. R. Silva

[permalink] [raw]
Subject: Re: linux-next: build warnings after merge of the kspp-gustavo tree


Hi Stephen,

On 11/22/23 00:24, Gustavo A. R. Silva wrote:
> Stephen,
>
> I need to double-check that. I'll be able to come back to work on this in 12-15 hours. I'm about to travel.
>
> Thanks
> --
> Gustavo
>
>
> On Nov 21, 2023, 23:15, at 23:15, Stephen Rothwell <[email protected]> wrote:
>> Hi Gustavo,
>>
>> On Tue, 21 Nov 2023 22:04:17 -0600 "Gustavo A. R. Silva"
>> <[email protected]> wrote:
>>>
>>> This doesn't show up with more recent compilers because it was an
>> issue in GCC.
>>
>> Sure, but we do still support gcc back to v5.1 .. are there other
>> earlier versions where you may want to suppress these warnings?

The GCC bug only appears in GCC 11. We should catch and fix -Wstringop-overflow
warnings with the rest of the versions that support this compiler option. :)

Thanks!
--
Gustavo

2023-11-27 22:19:12

by Stephen Rothwell

[permalink] [raw]
Subject: Re: linux-next: build warnings after merge of the kspp-gustavo tree

Hi Gustavo,

On Wed, 22 Nov 2023 10:21:27 +0530 "Aithal, Srikanth" <[email protected]> wrote:
>
> @Gustavo I see you have mentioned it as gcc issue. I was not hitting this until yesterdays linux-next build. I am on latest gcc which RHEL 9.x provides,
> gcc --version
> gcc (GCC) 11.4.1 20230605 (Red Hat 11.4.1-2)

Given that gcc 11 is a provided compiler on RHEL 9, can you not add
-Wstringop-overflow for that compiler, please.

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2023-11-28 21:18:35

by Gustavo A. R. Silva

[permalink] [raw]
Subject: Re: linux-next: build warnings after merge of the kspp-gustavo tree

Hi Stephen,

On 11/27/23 16:13, Stephen Rothwell wrote:
> Hi Gustavo,
>
> On Wed, 22 Nov 2023 10:21:27 +0530 "Aithal, Srikanth" <[email protected]> wrote:
>>
>> @Gustavo I see you have mentioned it as gcc issue. I was not hitting this until yesterdays linux-next build. I am on latest gcc which RHEL 9.x provides,
>> gcc --version
>> gcc (GCC) 11.4.1 20230605 (Red Hat 11.4.1-2)
>
> Given that gcc 11 is a provided compiler on RHEL 9, can you not add
> -Wstringop-overflow for that compiler, please.


Sure thing. Working on that. :)

--
Gustavo

2023-11-30 21:55:45

by Gustavo A. R. Silva

[permalink] [raw]
Subject: Re: linux-next: build warnings after merge of the kspp-gustavo tree

Hi Stephen,

On 11/28/23 15:11, Gustavo A. R. Silva wrote:
> Hi Stephen,
>
> On 11/27/23 16:13, Stephen Rothwell wrote:
>> Hi Gustavo,
>>
>> On Wed, 22 Nov 2023 10:21:27 +0530 "Aithal, Srikanth" <[email protected]> wrote:
>>>
>>> @Gustavo I see you have mentioned it as gcc issue. I was not hitting this until yesterdays linux-next build. I am on latest gcc which RHEL 9.x provides,
>>> gcc --version
>>> gcc (GCC) 11.4.1 20230605 (Red Hat 11.4.1-2)
>>
>> Given that gcc 11 is a provided compiler on RHEL 9, can you not add
>> -Wstringop-overflow for that compiler, please.

Done:

https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/commit/?h=for-next/kspp&id=617ab3c357d2ebdfff0e1a090c46f2f3f29b45e2

Thanks!
--
Gustavo

>
>
> Sure thing. Working on that. :)
>
> --
> Gustavo
>

2023-11-30 22:10:57

by Stephen Rothwell

[permalink] [raw]
Subject: Re: linux-next: build warnings after merge of the kspp-gustavo tree

Hi Gustavo,

On Thu, 30 Nov 2023 15:54:57 -0600 "Gustavo A. R. Silva" <[email protected]> wrote:
>

> >> Given that gcc 11 is a provided compiler on RHEL 9, can you not add
> >> -Wstringop-overflow for that compiler, please.
>
> Done:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/commit/?h=for-next/kspp&id=617ab3c357d2ebdfff0e1a090c46f2f3f29b45e2

Thanks.

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2023-12-01 08:41:22

by Aithal, Srikanth

[permalink] [raw]
Subject: Re: linux-next: build warnings after merge of the kspp-gustavo tree

On 12/1/2023 3:24 AM, Gustavo A. R. Silva wrote:
> Hi Stephen,
>
> On 11/28/23 15:11, Gustavo A. R. Silva wrote:
>> Hi Stephen,
>>
>> On 11/27/23 16:13, Stephen Rothwell wrote:
>>> Hi Gustavo,
>>>
>>> On Wed, 22 Nov 2023 10:21:27 +0530 "Aithal, Srikanth"
>>> <[email protected]> wrote:
>>>>
>>>> @Gustavo I see you have mentioned it as gcc issue. I was not hitting
>>>> this until yesterdays linux-next build. I am on latest gcc which
>>>> RHEL 9.x provides,
>>>> gcc --version
>>>> gcc (GCC) 11.4.1 20230605 (Red Hat 11.4.1-2)
>>>
>>> Given that gcc 11 is a provided compiler on RHEL 9, can you not add
>>> -Wstringop-overflow for that compiler, please.
>
> Done:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/commit/?h=for-next/kspp&id=617ab3c357d2ebdfff0e1a090c46f2f3f29b45e2
>
> Thanks!
> --
> Gustavo
>
Thank you, next-20231201 builds well on gcc 11.4.1
Tested-by: [email protected]
>>
>>
>> Sure thing. Working on that. :)
>>
>> --
>> Gustavo
>>