[PATCH] platform/x86/amd/pmf: fix compat ioctl handling

Arnd Bergmann posted 1 patch 1 week, 2 days ago
drivers/platform/x86/amd/pmf/util.c | 1 +
include/uapi/linux/amd-pmf.h        | 3 +++
2 files changed, 4 insertions(+)
[PATCH] platform/x86/amd/pmf: fix compat ioctl handling
Posted by Arnd Bergmann 1 week, 2 days ago
From: Arnd Bergmann <arnd@arndb.de>

Build testing with -Wpadded shows a structure that is incompatible
between 32-bit and 64-bit x86 userspace:

./usr/include/linux/amd-pmf.h:202:1: error: padding struct size to alignment boundary with 4 bytes [-Werror=padded]

Use the 64-bit padded on all architectures here to avoid both
the warning and allow compat ioctl handling.

Fixes: 98432eec3180 ("platform/x86/amd/pmf: Add util layer and userspace character device interface")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/platform/x86/amd/pmf/util.c | 1 +
 include/uapi/linux/amd-pmf.h        | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/drivers/platform/x86/amd/pmf/util.c b/drivers/platform/x86/amd/pmf/util.c
index 4d1a61e4f1b9..2befc1b14842 100644
--- a/drivers/platform/x86/amd/pmf/util.c
+++ b/drivers/platform/x86/amd/pmf/util.c
@@ -123,6 +123,7 @@ static const struct file_operations pmf_if_ops = {
 	.owner          = THIS_MODULE,
 	.open           = amd_pmf_open,
 	.unlocked_ioctl = amd_pmf_set_ioctl,
+	.compat_ioctl	= compat_ptr_ioctl,
 };
 
 static struct miscdevice amd_pmf_util_if = {
diff --git a/include/uapi/linux/amd-pmf.h b/include/uapi/linux/amd-pmf.h
index 24cf9926dc59..151f264cd7d6 100644
--- a/include/uapi/linux/amd-pmf.h
+++ b/include/uapi/linux/amd-pmf.h
@@ -199,6 +199,9 @@ struct amd_pmf_info {
 	/* BIOS parameters */
 	__u32 bios_input[AMD_PMF_BIOS_PARAMS_MAX];
 	__u32 bios_output[AMD_PMF_BIOS_PARAMS_MAX];
+
+	/* align to 64 bit boundary */
+	__u32 __pad;
 };
 
 #endif /* _UAPI_LINUX_AMD_PMF_H */
-- 
2.53.0
Re: [PATCH] platform/x86/amd/pmf: fix compat ioctl handling
Posted by Ilpo Järvinen 6 days, 11 hours ago
On Tue, 15 Sep 2026 22:25:20 +0200, Arnd Bergmann wrote:

> Build testing with -Wpadded shows a structure that is incompatible
> between 32-bit and 64-bit x86 userspace:
> 
> ./usr/include/linux/amd-pmf.h:202:1: error: padding struct size to alignment boundary with 4 bytes [-Werror=padded]
> 
> Use the 64-bit padded on all architectures here to avoid both
> the warning and allow compat ioctl handling.
> 
> [...]

Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.

FYI [if applicable to your patch], as per Linus' policy change, also
fixes are mostly routed through for-next unless the fix is for a
commit introduced in the most recent cycle or is clearly a regression
fix.

The list of commits applied:
[1/1] platform/x86/amd/pmf: fix compat ioctl handling
      commit: ac523aa5562fd4761509a012a68d2462ccf6c921

--
 i.