Skip to contentSkip to conversation

alloc_tag: avoid implicit padding in uapi

PATCH Superseded Arnd Bergmann 4 participants 4 messages Sep 15 – Sep 16

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 alloc_tag: avoid implicit padding in uapi

From: Arnd Bergmann <[email protected]>

The impliied padding causes a harmless warning when testing the uapi headers with -Wpadded that could in theory indicate incompatibilies or data leaks:

./usr/include/linux/alloc_tag.h:41:1: error: padding struct size to alignment boundary with 7 bytes [-Werror=padded]

The code here is fine, but it's better to make the padding explicit and avoid the warning here.

Fixes 1d581ab2348c ("alloc_tag: add ioctl to /proc/allocinfo")
---
 include/uapi/linux/alloc_tag.h | 1 +
 1 file changed, 1 insertion(+)
include/uapi/linux/alloc_tag.h +1 -0
index e3ad94444864..7d4618bea043 100644
@@ -38,6 +38,7 @@ struct allocinfo_counter {
 	__u64 bytes;
 	__u64 calls;
 	__u8 accurate;
+	__u8 pad[7];
 } __attribute__((aligned(8)));
 
 struct allocinfo_tag_data {
Signature · 1 line
2.53.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The impliied padding causes a harmless warning when testing the uapi headers with -Wpadded that could in theory indicate incompatibilies or data leaks:

Quoted 7 lines

./usr/include/linux/alloc_tag.h:41:1: error: padding struct size to alignment boundary with 7 bytes [-Werror=padded]

The code here is fine, but it's better to make the padding explicit and avoid the warning here.

Fixes 1d581ab2348c ("alloc_tag: add ioctl to /proc/allocinfo")

Thanks!

Quoted 19 lines
---
 include/uapi/linux/alloc_tag.h | 1 +
 1 file changed, 1 insertion(+)
include/uapi/linux/alloc_tag.h +1 -1
index e3ad94444864..7d4618bea043 100644
@@ -38,6 +38,7 @@ struct allocinfo_counter {
        __u64 bytes;
        __u64 calls;
        __u8 accurate;
+       __u8 pad[7];
 } __attribute__((aligned(8)));
 
 struct allocinfo_tag_data {
--

2.53.0

Acked-by on v1 1/1
#2 lore raw
In reply to Arnd Bergmann
Quoted 3 lines · On Tue, 15 Sep 2026 22:23:47 +0200 Arnd Bergmann <[email protected]> wrote:

From: Arnd Bergmann <[email protected]>

The impliied padding causes a harmless warning when testing the uapi

s/impliied/implied/

Quoted 1 line

headers with -Wpadded that could in theory indicate incompatibilies or

s/incompatibilies/incompatibilities/

Quoted 6 lines

data leaks:

./usr/include/linux/alloc_tag.h:41:1: error: padding struct size to alignment boundary with 7 bytes [-Werror=padded]

The code here is fine, but it's better to make the padding explicit and avoid the warning here.

Typos are trivial and the change makes sense to me.

Quoted 3 lines
Fixes 1d581ab2348c ("alloc_tag: add ioctl to /proc/allocinfo")

Thanks,
SJ

[...]

reviewer Acked-by on v1 1/1
#3 lore raw
In reply to Arnd Bergmann
Quoted 6 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The impliied padding causes a harmless warning when testing the uapi headers with -Wpadded that could in theory indicate incompatibilies or data leaks:

Quoted 7 lines

./usr/include/linux/alloc_tag.h:41:1: error: padding struct size to alignment boundary with 7 bytes [-Werror=padded]

The code here is fine, but it's better to make the padding explicit and avoid the warning here.

Fixes 1d581ab2348c ("alloc_tag: add ioctl to /proc/allocinfo")

Thanks for the fix, with the nit from SJ.

Thanks
Best Regards
Hao

Quoted 16 lines
---
 include/uapi/linux/alloc_tag.h | 1 +
 1 file changed, 1 insertion(+)
include/uapi/linux/alloc_tag.h +1 -0
index e3ad94444864..7d4618bea043 100644
@@ -38,6 +38,7 @@ struct allocinfo_counter {
 	__u64 bytes;
 	__u64 calls;
 	__u8 accurate;
+	__u8 pad[7];
 } __attribute__((aligned(8)));
 
 struct allocinfo_tag_data {