public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix stringop-overflow warning in test-strncat.
@ 2023-02-28 12:48 Stefan Liebler
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Liebler @ 2023-02-28 12:48 UTC (permalink / raw)
  To: libc-alpha; +Cc: Stefan Liebler

Starting with commit
b2c474f8de4c92bfe7435853a96805ec32d68dfa
"x86: Fix strncat-avx2.S reading past length [BZ #30065]"

Building on s390 the test fails due warnings like:

In function ‘do_one_test’,
    inlined from ‘do_overflow_tests’ at test-strncat.c:175:7:
test-strncat.c:31:18: error: ‘strnlen’ specified bound [4294966546, 4294967295] exceeds maximum object size 2147483647 [-Werror=stringop-overflow=]
   31 | # define STRNLEN strnlen
      |                  ^
test-strncat.c:83:16: note: in expansion of macro ‘STRNLEN’
   83 |   size_t len = STRNLEN (src, n);
|                ^~~~~~~

In all werror cases, the call to strnlen (.., SIZE_MAX) is inlined.
Therefore this patch just marks the do_one_test function as noinline.
---
 string/test-strncat.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/string/test-strncat.c b/string/test-strncat.c
index c0cde206ee..e71724df5b 100644
--- a/string/test-strncat.c
+++ b/string/test-strncat.c
@@ -69,6 +69,7 @@ SIMPLE_STRNCAT (CHAR *dst, const CHAR *src, size_t n)
 }
 
 static void
+__attribute__((noinline))
 do_one_test (impl_t *impl, CHAR *dst, const CHAR *src, size_t n)
 {
   size_t k = STRLEN (dst);
-- 
2.39.1


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

* Re: [PATCH] Fix stringop-overflow warning in test-strncat.
  2023-03-02 10:23 Wilco Dijkstra
@ 2023-03-02 13:26 ` Stefan Liebler
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Liebler @ 2023-03-02 13:26 UTC (permalink / raw)
  To: Wilco Dijkstra; +Cc: 'GNU C Library'

On 02.03.23 11:23, Wilco Dijkstra wrote:
> Hi Stefan,
> 
>> In all werror cases, the call to strnlen (.., SIZE_MAX) is inlined.
>> Therefore this patch just marks the do_one_test function as noinline.
> 
> LGTM
> 
> Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
> 
> Cheers,
> Wilco
> 
>  static void
> +__attribute__((noinline))
>  do_one_test (impl_t *impl, CHAR *dst, const CHAR *src, size_t n)
>  {
>    size_t k = STRLEN (dst);
> 
> OK

I've just committed the patch.

Thanks,
Stefan

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

* Re: [PATCH] Fix stringop-overflow warning in test-strncat.
@ 2023-03-02 10:23 Wilco Dijkstra
  2023-03-02 13:26 ` Stefan Liebler
  0 siblings, 1 reply; 3+ messages in thread
From: Wilco Dijkstra @ 2023-03-02 10:23 UTC (permalink / raw)
  To: stli; +Cc: 'GNU C Library'

Hi Stefan,

> In all werror cases, the call to strnlen (.., SIZE_MAX) is inlined.
> Therefore this patch just marks the do_one_test function as noinline.

LGTM

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>

Cheers,
Wilco

 static void
+__attribute__((noinline))
 do_one_test (impl_t *impl, CHAR *dst, const CHAR *src, size_t n)
 {
   size_t k = STRLEN (dst);

OK

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

end of thread, other threads:[~2023-03-02 13:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-28 12:48 [PATCH] Fix stringop-overflow warning in test-strncat Stefan Liebler
2023-03-02 10:23 Wilco Dijkstra
2023-03-02 13:26 ` Stefan Liebler

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 read-only IMAP folder(s) and NNTP newsgroup(s).