From patchwork Fri Jun 16 16:41:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 13283000 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 0F031EB64D7 for ; Fri, 16 Jun 2023 16:42:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Message-Id:MIME-Version:Subject: Date:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=IAyiELkjOBpHJcCJ8PGcmNcjYpi61SfGmKPp8gTgSTM=; b=H8/5zYr2+ROHot RbqCsVGdac7JWlmPpYzrKj8JnN/oQVIHCEEIaHiTplrVZCPItR7bigZ25rBE1b9WC3DjukEiGqOBL ybnpYyWWC5faab5C+SekeXKqM9hE0uvk4Dq3sKYP/wkmzHwPGCtFO+wAtvOmyZNDfsSMghMCRQ71m kiI4Wv5SrEGaHA1FrpxpKkysVO3z7nmHfg8JJttp6NzaxZ4HQVEbptMouKa0foNxr/Z7Z8GANzdl8 cCUWxOKp5MaanKGSU6K5lzXv/3iMNkTJMbEUJlIzsGxGIMTfBh8u1xzC+lkbeSO+MbmDPr+XeUq2g 0dPMaA/OepiVZhMhTJEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qACW8-0019O1-1B; Fri, 16 Jun 2023 16:41:44 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qACW4-0019Ma-2M for linux-arm-kernel@lists.infradead.org; Fri, 16 Jun 2023 16:41:42 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9BF4F60DD7; Fri, 16 Jun 2023 16:41:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7ED29C433C0; Fri, 16 Jun 2023 16:41:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686933699; bh=wVP9KiItEr8mSN+tUTw1LX0kVRv/kPOjeQ4/eD7jAGQ=; h=From:Date:Subject:To:Cc:From; b=iYgsjdiZFE5XgFNrwAXDyB2HL4aWLv5j/6Sw40HMnepdzIRc92o0Gitqy66qikBeP ETCbvFXDbne2TZWh8TEh7U32pvcgY4hAALxNNlUw1vb2oh5ctGsRM2cRt/hfwg0RDP JkVMmurdcqDQLtcPT8wC8H4XOScWj9gd3SZzc/lgFk0wh0oYfIoJUdDh7ZvHlHguQO /1XE2TnV+K3tlsyDZ8BRZscbbkHVKVfv3HqHJaEaiRdZiFVvYVU6ducRGdYbzbSZCU PoRkI1G5rQA6SMzzYNIoBtP0oxeOpcD1754mEBYinoCsrNroU5lTl/ewifXAG1C4xr p9C5ahwTfMIjQ== From: Nathan Chancellor Date: Fri, 16 Jun 2023 09:41:30 -0700 Subject: [PATCH] coresight: dummy: Update type of mode parameter in dummy_{sink,source}_enable() MIME-Version: 1.0 Message-Id: <20230616-coresight-dummy-fix-kcfi-warnings-v1-1-c55c64f8f0f5@kernel.org> X-B4-Tracking: v=1; b=H4sIALmQjGQC/x2NSwrDMAwFrxK8rsBOwU17ldKFYiu2KHaKlP4Iu XudLofhzVuNkjCpuXSrEXqx8lwbuENnQsaaCDg2Nr3tj9Y7D2EWUk55gfgs5QsTf+AeJoY3SuW aFLwfTjjGIVp3Nq0zohKMgjXkvVRQF5JdPITa+n9+vW3bD+4jZmeMAAAA To: suzuki.poulose@arm.com Cc: mike.leach@linaro.org, james.clark@arm.com, leo.yan@linaro.org, quic_hazha@quicinc.com, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, llvm@lists.linux.dev, patches@lists.linux.dev, Nathan Chancellor X-Mailer: b4 0.13-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=3308; i=nathan@kernel.org; h=from:subject:message-id; bh=wVP9KiItEr8mSN+tUTw1LX0kVRv/kPOjeQ4/eD7jAGQ=; b=owGbwMvMwCEmm602sfCA1DTG02pJDCk9Ew79uibVedT37S+9vKA+PYHSCQcUI9arsrFkzlp42 8tC/mldRykLgxgHg6yYIkv1Y9XjhoZzzjLeODUJZg4rE8gQBi5OAZhIAjsjw6T0jcaPGTsDbs3V 6PtbJ+M186UX2zWVuJfS+UdLbDy4nRn+Bzw+JiCWkxqaEqCoNeF+Za/opkuGPWxbk3OPuNy7NnM SNwA= X-Developer-Key: i=nathan@kernel.org; a=openpgp; fpr=2437CB76E544CB6AB3D9DFD399739260CB6CB716 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230616_094140_861666_ECD10B55 X-CRM114-Status: GOOD ( 13.50 ) 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 Clang's kernel Control Flow Integrity (kCFI) is a compiler-based security mitigation that ensures the target of an indirect function call matches the expected type of the call and trapping if they do not match exactly. The warning -Wincompatible-function-pointer-types-strict aims to catch these issues at compile time, which reveals: drivers/hwtracing/coresight/coresight-dummy.c:53:12: error: incompatible function pointer types initializing 'int (*)(struct coresight_device *, struct perf_event *, enum cs_mode)' with an expression of type 'int (struct coresight_device *, struct perf_event *, u32)' (aka 'int (struct coresight_device *, struct perf_event *, unsigned int)') [-Werror,-Wincompatible-function-pointer-types-strict] 53 | .enable = dummy_source_enable, | ^~~~~~~~~~~~~~~~~~~ drivers/hwtracing/coresight/coresight-dummy.c:62:12: error: incompatible function pointer types initializing 'int (*)(struct coresight_device *, enum cs_mode, void *)' with an expression of type 'int (struct coresight_device *, u32, void *)' (aka 'int (struct coresight_device *, unsigned int, void *)') [-Werror,-Wincompatible-function-pointer-types-strict] 62 | .enable = dummy_sink_enable, | ^~~~~~~~~~~~~~~~~ 2 errors generated. Commit 9fa3682869d4 ("coresight: Use enum type for cs_mode wherever possible") updated the type of the mode parameter in the prototype but this driver was not introduced until commit 9d3ba0b6c056 ("Coresight: Add coresight dummy driver") and 'int' is ABI compatible with 'enum cs_mode', so there is no warning from regular -Wincompatible-function-pointer-types. Adjust the type of the mode parameter in the callback implementations in the coresight dummy driver to match the prototype, clearing up the warning and avoiding kCFI failures at runtime. Fixes: 9d3ba0b6c056 ("Coresight: Add coresight dummy driver") Signed-off-by: Nathan Chancellor --- drivers/hwtracing/coresight/coresight-dummy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- base-commit: 3b79104f80036231a40ba5d15c3e329985029a0f change-id: 20230616-coresight-dummy-fix-kcfi-warnings-6687abd8d019 Best regards, diff --git a/drivers/hwtracing/coresight/coresight-dummy.c b/drivers/hwtracing/coresight/coresight-dummy.c index 42125b7a0f39..8035120b70b3 100644 --- a/drivers/hwtracing/coresight/coresight-dummy.c +++ b/drivers/hwtracing/coresight/coresight-dummy.c @@ -21,7 +21,7 @@ DEFINE_CORESIGHT_DEVLIST(source_devs, "dummy_source"); DEFINE_CORESIGHT_DEVLIST(sink_devs, "dummy_sink"); static int dummy_source_enable(struct coresight_device *csdev, - struct perf_event *event, u32 mode) + struct perf_event *event, enum cs_mode mode) { dev_dbg(csdev->dev.parent, "Dummy source enabled\n"); @@ -34,7 +34,7 @@ static void dummy_source_disable(struct coresight_device *csdev, dev_dbg(csdev->dev.parent, "Dummy source disabled\n"); } -static int dummy_sink_enable(struct coresight_device *csdev, u32 mode, +static int dummy_sink_enable(struct coresight_device *csdev, enum cs_mode mode, void *data) { dev_dbg(csdev->dev.parent, "Dummy sink enabled\n");