From patchwork Fri Aug 16 15:32:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 13766570 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 751ABC531DC for ; Fri, 16 Aug 2024 15:48:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LihjiCBoXvrmxP/NVHN8VEddhOPo1Sid5sWi1K5Z/cM=; b=YAGKiC7Biij9olC/PxNtCFLoTt rpCCwzyLBmTKJgeeJRbijsyIbYQ8so7B+ky+icC5scMmC5M09EdSZksn+3SJ8hWRcqzjWPq78qE/r E30ix7XrjuIDLhj7ssFQvwyzLtWeCvk6y1xy1CkBBMu3ugZvjRNO5S1SERcrrbhQGvJpo3GkwX6I8 6BZQgA7kfqVcDlZhp4cnGiauvlEIb432I4tTlqMVjGuJ2UD3YCCpscd3JJeSPxTTiM752452ubKkc t9nGKCzYPTPAHXPjvxk7U9zOR0FzcB/i2sx47rZHzkKjmMCcUcQ37bjnsG+WjI5sWeWeNWrakfRy2 mq5cRSlw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sezBR-0000000DSXw-3hPi; Fri, 16 Aug 2024 15:48:09 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seywt-0000000DOzi-0Fh3 for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 15:33:08 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D208C1474; Fri, 16 Aug 2024 08:33:32 -0700 (PDT) Received: from donnerap.arm.com (donnerap.manchester.arm.com [10.32.100.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7A6613F6A8; Fri, 16 Aug 2024 08:33:05 -0700 (PDT) From: Andre Przywara To: Catalin Marinas , Will Deacon , Shuah Khan Cc: Mark Brown , Amit Daniel Kachhap , linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org Subject: [PATCH 5/8] kselftest/arm64: mte: fix printf type warning about mask Date: Fri, 16 Aug 2024 16:32:48 +0100 Message-Id: <20240816153251.2833702-6-andre.przywara@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240816153251.2833702-1-andre.przywara@arm.com> References: <20240816153251.2833702-1-andre.przywara@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240816_083307_183716_01FE5FB6 X-CRM114-Status: GOOD ( 13.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When masking the return value of a prctl, which is clearly an "int", we use a uapi header provided mask, which is defined using an "UL" modifier, so the whole expression is promoted to a long. This upsets the compiler's printf type checker, because we use "%x" in the format string. While we could simply upgrade this to a "%lx", it sounds wrong to promote the "ret" variable, that is clearly an int. Downcast the mask instead, to keep the type correct. Fixes: e2d9642a5a51 ("kselftest/arm64: Add simple test for MTE prctl") Signed-off-by: Andre Przywara --- tools/testing/selftests/arm64/mte/check_prctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/arm64/mte/check_prctl.c b/tools/testing/selftests/arm64/mte/check_prctl.c index f139a33a43ef4..a16d7005affdf 100644 --- a/tools/testing/selftests/arm64/mte/check_prctl.c +++ b/tools/testing/selftests/arm64/mte/check_prctl.c @@ -81,11 +81,11 @@ void set_mode_test(const char *name, int hwcap2, int mask) return; } - if ((ret & PR_MTE_TCF_MASK) == mask) { + if ((ret & (int)PR_MTE_TCF_MASK) == mask) { ksft_test_result_pass("%s\n", name); } else { ksft_print_msg("Got %x, expected %x\n", - (ret & PR_MTE_TCF_MASK), mask); + (ret & (int)PR_MTE_TCF_MASK), mask); ksft_test_result_fail("%s\n", name); } }