public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nicolin Chen <nicolinc@nvidia.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: Joerg Roedel <joro@8bytes.org>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Vasant Hegde <vasant.hegde@amd.com>,
	Jason Gunthorpe <jgg@ziepe.ca>, <iommu@lists.linux.dev>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] iommu/amd: Fix type of type parameter to amd_iommufd_hw_info()
Date: Thu, 22 Jan 2026 16:37:14 -0800	[thread overview]
Message-ID: <aXLCuqqg1tfBuJbb@Asurada-Nvidia> (raw)
In-Reply-To: <20260122-amd-iommufd-fix-wifpts-v1-1-8ee604527875@kernel.org>

On Thu, Jan 22, 2026 at 02:42:38PM -0700, Nathan Chancellor wrote:
> When building with -Wincompatible-function-pointer-types-strict, a
> warning designed to catch kernel control flow integrity (kCFI) issues at
> build time, there is an instance around amd_iommufd_hw_info():
> 
>   drivers/iommu/amd/iommu.c:3141:13: error: incompatible function pointer types initializing 'void *(*)(struct device *, u32 *, enum iommu_hw_info_type *)' (aka 'void *(*)(struct device *, unsigned int *, enum iommu_hw_info_type *)') with an expression of type 'void *(struct device *, u32 *, u32 *)' (aka 'void *(struct device *, unsigned int *, unsigned int *)') [-Werror,-Wincompatible-function-pointer-types-strict]
>    3141 |         .hw_info = amd_iommufd_hw_info,
>         |                    ^~~~~~~~~~~~~~~~~~~
> 
> While 'u32 *' and 'enum iommu_hw_info_type *' are ABI compatible, hence
> no regular warning from -Wincompatible-function-pointer-types, the
> mismatch will trigger a kCFI violation when amd_iommufd_hw_info() is
> called indirectly.
> 
> Update the type parameter of amd_iommufd_hw_info() to be
> 'enum iommu_hw_info_type *' to match the prototype in
> 'struct iommu_ops', clearing up the warning and kCFI violation.
> 
> Fixes: 7d8b06ecc45b ("iommu/amd: Add support for hw_info for iommu capability query")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
 
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>

  parent reply	other threads:[~2026-01-23  0:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-22 21:42 [PATCH] iommu/amd: Fix type of type parameter to amd_iommufd_hw_info() Nathan Chancellor
2026-01-22 23:37 ` Jason Gunthorpe
2026-01-23  0:37 ` Nicolin Chen [this message]
2026-01-23  4:12 ` Vasant Hegde
2026-01-28 14:13 ` Joerg Roedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aXLCuqqg1tfBuJbb@Asurada-Nvidia \
    --to=nicolinc@nvidia.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nathan@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=vasant.hegde@amd.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox