From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1962) id 8024F3858D33; Thu, 2 Mar 2023 13:26:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8024F3858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677763578; bh=azinwI+8uqsjGYROEC+LsgLF9lisVRLkIwb0oaeS/EE=; h=From:To:Subject:Date:From; b=payMHh/d3nF22l2H+lYnfh0YpjJp21wvNoc5Ttgq3+J4pp9R7u1X9e5pHrmrvvUg3 H6orBQH1Sg08u6L3SWIuXWXGAnWt/LoXYDmAtUYlZmFTQChsywUvRr6Xfsb0x2YNB/ wYSMF9c3ftpryeb5BHkTgxsfvic0Wyv/JQZaDhDE= MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" From: Stefan Liebler To: glibc-cvs@sourceware.org Subject: [glibc] Fix stringop-overflow warning in test-strncat. X-Act-Checkin: glibc X-Git-Author: Stefan Liebler X-Git-Refname: refs/heads/master X-Git-Oldrev: 1e0c8356f591a62df9725b6c9387da78002ba412 X-Git-Newrev: 51aeab9a363a0d000d0912aa3d6490463a26fba2 Message-Id: <20230302132618.8024F3858D33@sourceware.org> Date: Thu, 2 Mar 2023 13:26:18 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=51aeab9a363a0d000d0912aa3d6490463a26fba2 commit 51aeab9a363a0d000d0912aa3d6490463a26fba2 Author: Stefan Liebler Date: Tue Feb 28 13:48:34 2023 +0100 Fix stringop-overflow warning in test-strncat. 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. Reviewed-by: Wilco Dijkstra Diff: --- 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);