From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B621E23EABC for ; Tue, 7 Apr 2026 08:10:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775549454; cv=none; b=ULtb0ZunhDXRawEYrIV3MF4yQeE/n7CHFBVlvt/qMUF66uaOjsE450S4TITvLu+MtCZSWHo4Nv0+SNXyZXzWVcspQmD2jWLqkmwY3hPCydaQtt6T7YUCCw0zP5TTCdSvE9svkJFlomnheFWl18By3Prgw2I6G02nfcyNETA3z3g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775549454; c=relaxed/simple; bh=wa8Bk5qYAqzC1U23ghWAMt0N32UINcdTL+QzfUMPJsI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QNTmA9wCslCcAxuYYuUtf3eEmWJxyTOmvgcvticCFgOleRNPPJR/raBqhXucWg3ROqc41YPaCVmIBbqYSFotZ7I6XK5qHpF5xSjMjxAJ+mrj9Yq5C1G0YkwR8xnuNIgOfIt6rwEGRvsU7qQDSyw/wXxjSXjxX7evltcLWxzvF9o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=p641DY+F; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="p641DY+F" 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 45B721688; Tue, 7 Apr 2026 01:10:45 -0700 (PDT) Received: from localhost (e132581.arm.com [10.1.196.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9ED873F641; Tue, 7 Apr 2026 01:10:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1775549451; bh=wa8Bk5qYAqzC1U23ghWAMt0N32UINcdTL+QzfUMPJsI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=p641DY+Fy2ySv9iOJpBsOkQrsZ7E5jraZoQXlTN6knbfYzQbv7HA1edZla1KTwT3D MlCbWCbYi4PQG6BoOtCsHAyIYM8ASN33yOBOyqSinFKfg+W00nU6FE7sxGTHNydcn3 /ehvutRm1GFISv+0iOeHISJHl9xp3rHfsB/Q2qB0= Date: Tue, 7 Apr 2026 09:10:48 +0100 From: Leo Yan To: Jie Gan Cc: Suzuki K Poulose , Mike Leach , James Clark , Alexander Shishkin , Tingwei Zhang , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] coresight: tpdm: fix invalid MMIO access issue Message-ID: <20260407081048.GJ356832@e132581.arm.com> References: <20260407-fix-potential-issue-in-tpdm-v1-1-42090d27c0a8@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260407-fix-potential-issue-in-tpdm-v1-1-42090d27c0a8@oss.qualcomm.com> On Tue, Apr 07, 2026 at 12:47:11PM +0800, Jie Gan wrote: > Create the csdev_access struct only when a valid MMIO resource is > available. In tpdm_probe(), base is uninitialized for static TPDM > instances that lack an MMIO resource, causing csdev_access to be > created with a garbage address and potentially leading to > unexpected issues. This patch itself is fine for me. However, I am wandering if this is sufficient. As mentioned "potentially leading to unexpected issues", can I understand some code pieces access register with uninitialized base? If so, you would also explictly add coresight_is_static_tpdm() to prevent register access. Thanks, Leo > Fixes: 14ae052f7947 ("coresight: tpdm: add static tpdm support") > Signed-off-by: Jie Gan > --- > drivers/hwtracing/coresight/coresight-tpdm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtracing/coresight/coresight-tpdm.c > index 9b16f368a58b..eaf7210af648 100644 > --- a/drivers/hwtracing/coresight/coresight-tpdm.c > +++ b/drivers/hwtracing/coresight/coresight-tpdm.c > @@ -1430,6 +1430,7 @@ static int tpdm_probe(struct device *dev, struct resource *res) > if (ret) > return ret; > > + desc.access = CSDEV_ACCESS_IOMEM(base); > if (tpdm_has_dsb_dataset(drvdata)) > of_property_read_u32(drvdata->dev->of_node, > "qcom,dsb-msrs-num", &drvdata->dsb_msr_num); > @@ -1452,7 +1453,6 @@ static int tpdm_probe(struct device *dev, struct resource *res) > desc.ops = &tpdm_cs_ops; > desc.pdata = dev->platform_data; > desc.dev = dev; > - desc.access = CSDEV_ACCESS_IOMEM(base); > if (res) > desc.groups = tpdm_attr_grps; > else > > --- > base-commit: 816f193dd0d95246f208590924dd962b192def78 > change-id: 20260407-fix-potential-issue-in-tpdm-b07b44416051 > > Best regards, > -- > Jie Gan >