Skip to content

Commit a462903

Browse files
jmberg-intelkuba-moo
authored andcommitted
net: netlink: reduce extack cookie size
Seems like the extack cookie hasn't found any users outside of wireless, which always uses nl_set_extack_cookie_u64(). Thus, allocating 20 bytes for it is pointless, reduce that to 8 bytes, and add a BUILD_BUG_ON() to ensure it's enough (obviously it is, for a u64, but in case it changes again.) Signed-off-by: Johannes Berg <johannes.berg@intel.com> Link: https://patch.msgid.link/20250516115927.38209-2-johannes@sipsolutions.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent a8ae8a0 commit a462903

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/linux/netlink.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ netlink_kernel_create(struct net *net, int unit, struct netlink_kernel_cfg *cfg)
6363
}
6464

6565
/* this can be increased when necessary - don't expose to userland */
66-
#define NETLINK_MAX_COOKIE_LEN 20
66+
#define NETLINK_MAX_COOKIE_LEN 8
6767
#define NETLINK_MAX_FMTMSG_LEN 80
6868

6969
/**
@@ -212,6 +212,7 @@ static inline void nl_set_extack_cookie_u64(struct netlink_ext_ack *extack,
212212
{
213213
if (!extack)
214214
return;
215+
BUILD_BUG_ON(sizeof(extack->cookie) < sizeof(cookie));
215216
memcpy(extack->cookie, &cookie, sizeof(cookie));
216217
extack->cookie_len = sizeof(cookie);
217218
}

0 commit comments

Comments
 (0)