From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 858F9183CB8; Tue, 8 Oct 2024 12:47:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728391659; cv=none; b=DZXl6dfsAT41wXVFxJHWsCyysBJsXridYmEQhwLbWJgKa/RezvZAowiDB5iOtjDVL6QPKUcrOBGjCoc7fWlOPnGIRFj0hPZ2zpY1EEcvjFeDLxHszBKNDDcl4/v3Tm8ryRc/s/rg+hNSYmGoA1Kz9eNaafPrYLULnuux6u7+B18= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728391659; c=relaxed/simple; bh=fJWBoV4pL31Anbe4ncgv0knel+T8wmiMFvq2mui2bNs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ArbX46vkrvrThV+IUosrlTHwbeQu+jjLMCt3X4NW0BqKezdk1M+53OkGvjzHpMXefFSh25faWshLASERxKGRZBUBFnqEgQ3fOopd7lZy/8me0qp0tTslerB5Bik20ITXGe5yaeSFE8rQ77moP/nMyQswFic76qcTuvOoPoKZOLo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=T6wELayN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="T6wELayN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 097EBC4CEC7; Tue, 8 Oct 2024 12:47:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728391659; bh=fJWBoV4pL31Anbe4ncgv0knel+T8wmiMFvq2mui2bNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T6wELayN3oH3xgbbDb/3FeRHbH60BrspzSlAfj82+O+WhCAHtLwfEM/TpBo0vIlKc 6NBD8HBGOoTcQaTgxjKfD7YJhwKpTtLaYV+niuWG//cADLyqqw5iM+A7D9x2fw/RiC tj8quG/YirEXQFcDHmiNe71g1gNueOgWCvO1BX8w= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Shuah Khan , Willy Tarreau , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Sasha Levin Subject: [PATCH 6.11 185/558] selftests/nolibc: avoid passing NULL to printf("%s") Date: Tue, 8 Oct 2024 14:03:35 +0200 Message-ID: <20241008115709.631592043@linuxfoundation.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241008115702.214071228@linuxfoundation.org> References: <20241008115702.214071228@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.11-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Weißschuh [ Upstream commit f1a58f61d88642ae1e6e97e9d72d73bc70a93cb8 ] Clang on higher optimization levels detects that NULL is passed to printf("%s") and warns about it. While printf() from nolibc gracefully handles that NULL, it is undefined behavior as per POSIX, so the warning is reasonable. Avoid the warning by transforming NULL into a non-NULL placeholder. Reviewed-by: Shuah Khan Acked-by: Willy Tarreau Link: https://lore.kernel.org/r/20240807-nolibc-llvm-v2-8-c20f2f5fc7c2@weissschuh.net Signed-off-by: Thomas Weißschuh Signed-off-by: Sasha Levin --- tools/testing/selftests/nolibc/nolibc-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index 093d0512f4c57..8cbb51dca0cd6 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -542,7 +542,7 @@ int expect_strzr(const char *expr, int llen) { int ret = 0; - llen += printf(" = <%s> ", expr); + llen += printf(" = <%s> ", expr ? expr : "(null)"); if (expr) { ret = 1; result(llen, FAIL); @@ -561,7 +561,7 @@ int expect_strnz(const char *expr, int llen) { int ret = 0; - llen += printf(" = <%s> ", expr); + llen += printf(" = <%s> ", expr ? expr : "(null)"); if (!expr) { ret = 1; result(llen, FAIL); -- 2.43.0