From nobody Mon Sep 29 21:25:15 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE23FC00140 for ; Mon, 15 Aug 2022 23:12:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346614AbiHOXM3 (ORCPT ); Mon, 15 Aug 2022 19:12:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353283AbiHOXLJ (ORCPT ); Mon, 15 Aug 2022 19:11:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84E3AE0; Mon, 15 Aug 2022 13:00:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A6B8E6068D; Mon, 15 Aug 2022 20:00:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B525EC433C1; Mon, 15 Aug 2022 20:00:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593613; bh=h1lAwXEzOBwnzyaZlWPDLYxbCPN2BU7bW/+B5CVB0Bs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J0u4ShBk6kw+GRja3stKOs2gEriAfq0Q098M8COs0H/kG1vIed7vPrbvUOW8xllfj 8kcWKxYRb9Qu3O3vBXy6v0Ki6Us0OvU77NeSzwzWo6VZJwrr9CF4lmk3V/POzE/3Qm Z69SO6qjA9qkizLOfyRIq2fuIFHTywFKmtLo6qd0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YiFei Zhu , Kees Cook , Sasha Levin Subject: [PATCH 5.19 0296/1157] selftests/seccomp: Fix compile warning when CC=clang Date: Mon, 15 Aug 2022 19:54:12 +0200 Message-Id: <20220815180451.485989045@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: YiFei Zhu [ Upstream commit 3ce4b78f73e8e00fb86bad67ee7f6fe12019707e ] clang has -Wconstant-conversion by default, and the constant 0xAAAAAAAAA (9 As) being converted to an int, which is generally 32 bits, results in the compile warning: clang -Wl,-no-as-needed -Wall -isystem ../../../../usr/include/ -lpthrea= d seccomp_bpf.c -lcap -o seccomp_bpf seccomp_bpf.c:812:67: warning: implicit conversion from 'long' to 'int' c= hanges value from 45812984490 to -1431655766 [-Wconstant-conversion] int kill =3D kill_how =3D=3D KILL_PROCESS ? SECCOMP_RET_KILL_PROC= ESS : 0xAAAAAAAAA; ~~~~ = ^~~~~~~~~~~ 1 warning generated. -1431655766 is the expected truncation, 0xAAAAAAAA (8 As), so use this directly in the code to avoid the warning. Fixes: 3932fcecd962 ("selftests/seccomp: Add test for unknown SECCOMP_RET k= ill behavior") Signed-off-by: YiFei Zhu Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20220526223407.1686936-1-zhuyifei@google.com Signed-off-by: Sasha Levin --- tools/testing/selftests/seccomp/seccomp_bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/= selftests/seccomp/seccomp_bpf.c index 136df5b76319..4ae6c8991307 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -809,7 +809,7 @@ void kill_thread_or_group(struct __test_metadata *_meta= data, .len =3D (unsigned short)ARRAY_SIZE(filter_thread), .filter =3D filter_thread, }; - int kill =3D kill_how =3D=3D KILL_PROCESS ? SECCOMP_RET_KILL_PROCESS : 0x= AAAAAAAAA; + int kill =3D kill_how =3D=3D KILL_PROCESS ? SECCOMP_RET_KILL_PROCESS : 0x= AAAAAAAA; struct sock_filter filter_process[] =3D { BPF_STMT(BPF_LD|BPF_W|BPF_ABS, offsetof(struct seccomp_data, nr)), --=20 2.35.1