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 1D1C01D26F2; Tue, 8 Oct 2024 12:21:19 +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=1728390080; cv=none; b=WKVrhEp/9kDkRczZ0nF/HE/zcUcgC31hrVW1oiI26pLPFNbq9DyETYYkrzAEGFysFxeiQBsNTW9F8vqVOGcr7S7RyR3rJDH2h0S0X5Vn8xHEB6BKzGqbj8AvLzQFIa09euxOihVkaLIldn8+UroDmgf9/nCqrGcEWye1bCr6LO0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728390080; c=relaxed/simple; bh=AR0rF7LGyMP8jHJavdIBlKXA+tr1V5ybKwEnHhpOx48=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BUKpHisxT6sGvhJaatY5uxu6sy8EEafuaaFhpqH+rwMG4fP2B3tl8sKEE7Y4WuFmwX0WSuTTVBBt2loehEBWzZKsd6KSih7/cPT05G+uoGvQtuuWUPPIzeH/tNStNFVRwTQDAw/vyaL+zPOQFwN6di3uOe8xrtUopaNhtKDX14Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=blPoSXK6; 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="blPoSXK6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AA03C4CEC7; Tue, 8 Oct 2024 12:21:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728390079; bh=AR0rF7LGyMP8jHJavdIBlKXA+tr1V5ybKwEnHhpOx48=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=blPoSXK6CGVIoeYKtU6MsWmVYQeUqIZ8gYUBmHJ+sFXpMu4DA4vSnN02Z3PucM8zT iB87Nsgkp/11EWEfOZJYdSXi94fL/G6reex670ZAr4wm/wdsGbhYL0pgs55ImU4Xfs jYP7/yhsSG4CRYm1OsmzEbbioDpIbznSxa26WMis= 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.10 157/482] selftests/nolibc: avoid passing NULL to printf("%s") Date: Tue, 8 Oct 2024 14:03:40 +0200 Message-ID: <20241008115654.484963908@linuxfoundation.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241008115648.280954295@linuxfoundation.org> References: <20241008115648.280954295@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.10-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 994477ee87bef..4bd8360d54225 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -534,7 +534,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); @@ -553,7 +553,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