Skip to contentSkip to conversation

platform/x86/amd/pmf: fix compat ioctl handling

PATCH In review Arnd Bergmann 2 participants 2 messages Sep 15 – Sep 18

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86/amd/pmf: fix compat ioctl handling

From: Arnd Bergmann <[email protected]>

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")
---
 drivers/platform/x86/amd/pmf/util.c | 1 +
 include/uapi/linux/amd-pmf.h        | 3 +++
 2 files changed, 4 insertions(+)
drivers/platform/x86/amd/pmf/util.c +1 -0
index 4d1a61e4f1b9..2befc1b14842 100644
@@ -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 = {
include/uapi/linux/amd-pmf.h +3 -0
index 24cf9926dc59..151f264cd7d6 100644
@@ -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 */
Signature · 1 line
2.53.0
maintainer
#1 lore raw
Quoted 9 lines · Arnd Bergmann

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.