]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix stringop-overflow warning in test-strncat.
authorStefan Liebler <stli@linux.ibm.com>
Tue, 28 Feb 2023 12:48:34 +0000 (13:48 +0100)
committerStefan Liebler <stli@linux.ibm.com>
Thu, 2 Mar 2023 13:25:34 +0000 (14:25 +0100)
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 [42949665464294967295] 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.

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
string/test-strncat.c

index c0cde206eeccc6fe5ef7d1ebb95ad347f9e3552a..e71724df5b0c39f7f92bb5e53d620df54e94f753 100644 (file)
@@ -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);