Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2920137rwb; Mon, 15 Aug 2022 14:04:31 -0700 (PDT) X-Google-Smtp-Source: AA6agR676VokXOkc7TfW4zOZ3gbrfYftD1CDI32gVi8GM97q2x9Jd0iMvJQNDG0uGjLp6sce9YE3 X-Received: by 2002:a17:902:7247:b0:16e:ecb2:4870 with SMTP id c7-20020a170902724700b0016eecb24870mr18762260pll.110.1660597471479; Mon, 15 Aug 2022 14:04:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597471; cv=none; d=google.com; s=arc-20160816; b=dIaDNHYmY+aW+Bhg1rCoqyOsZDUDxG8Y5P3WSfAe/p067R2L0FQMhno69vT8scE8xc LG8B4Ty08uihkvWIFcZfP+g/cuw5PdmuG8/bNcEJ+SOtjxAv3QjgEdi7n+RVxYelm+6d Xsqay3Bl/5sO3BLreqigeYkXfyM4UCbJDn4YzCMs2NBbIxznjruXd3t37rBtQUXLRG/I OCTttsI6BFrPUeHhVjnacT4cSRQt4zUrXy+oLGQVpu0kXwpEmAZf+8Yx5gsF0Bfn363F Se/q7+31zd85cF8M+MmHkq3PIazY8qEud2o8ZYaZU9hGZI8S2/sWWRwIVC6A1MizY/IV pElw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2Q4SB6khxZWmV90nhW40/L8C5poD0zN29F+jyfUJbAo=; b=cVZbBXDxOhGTmgGPLaIHBC84fbmNjrguuus5xuLiOe4cxn606DE4xMZYNAmdWCGTAA pIJhO3hGeQtSzHlVbl4LRv2thf9Y0Bo+E5G4BJDnlqcAs607sU1+rQGPqpbbS8LvRk2O WHToyeO3nHy2njl4qow+7kXdPzXw7Mf+2ezDtcN65sEimyYe2+vTHBHDeGkmsK1T0RVX +dXLTlPnjIsLCbOX7lryg1Agtf9R87VrgecuiHFxVyI+JpWl+HDEvoJhEbTItPEA85SN puxIYCl/RviD6Mdrw76lXoDI+oW+1wkZxIbKb4tscNYszN0FlxBwxiWZU98uyraqkig5 CWGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="mpQy/a76"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d1-20020a636801000000b0041bc27c45besi11764095pgc.615.2022.08.15.14.04.20; Mon, 15 Aug 2022 14:04:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="mpQy/a76"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346271AbiHOUwV (ORCPT + 99 others); Mon, 15 Aug 2022 16:52:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345880AbiHOUub (ORCPT ); Mon, 15 Aug 2022 16:50:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEE70BA9D1; Mon, 15 Aug 2022 12:09:36 -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 ams.source.kernel.org (Postfix) with ESMTPS id A1BF8B81115; Mon, 15 Aug 2022 19:09:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7655C433C1; Mon, 15 Aug 2022 19:09:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590573; bh=4zHJyk7rxxViGtfeCsyafRUduSS2cv1pFUD28Yv+0IM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mpQy/a768VjhE7oKMiwUCui3CGXidgqd5uZRnkgBnaULTB/52eDE8e+of+Aa81/gi e3hlcA8c7xTh4eSVzCp4sZrEZYob4n+AgR5m91ZdE9zuUF6VaCrN6gBaTBdJYyu+21 yPZZe3Vxivx4Jzjqz7dfMf4y8hELplss3dUMi3Kw= 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.18 0295/1095] selftests/seccomp: Fix compile warning when CC=clang Date: Mon, 15 Aug 2022 19:54:54 +0200 Message-Id: <20220815180441.980828101@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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/ -lpthread seccomp_bpf.c -lcap -o seccomp_bpf seccomp_bpf.c:812:67: warning: implicit conversion from 'long' to 'int' changes value from 45812984490 to -1431655766 [-Wconstant-conversion] int kill = kill_how == KILL_PROCESS ? SECCOMP_RET_KILL_PROCESS : 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 kill 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 313bb0cbfb1e..6f65eeb6a3dd 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -802,7 +802,7 @@ void kill_thread_or_group(struct __test_metadata *_metadata, .len = (unsigned short)ARRAY_SIZE(filter_thread), .filter = filter_thread, }; - int kill = kill_how == KILL_PROCESS ? SECCOMP_RET_KILL_PROCESS : 0xAAAAAAAAA; + int kill = kill_how == KILL_PROCESS ? SECCOMP_RET_KILL_PROCESS : 0xAAAAAAAA; struct sock_filter filter_process[] = { BPF_STMT(BPF_LD|BPF_W|BPF_ABS, offsetof(struct seccomp_data, nr)), -- 2.35.1