netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: netlink: reduce extack cookie size
@ 2025-05-16 11:59 Johannes Berg
  2025-05-16 23:37 ` Jakub Kicinski
  2025-05-20  3:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Johannes Berg @ 2025-05-16 11:59 UTC (permalink / raw)
  To: linux-wireless, netdev; +Cc: Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

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>
---
 include/linux/netlink.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index c3ae84a77e16..882e9c1b6c1d 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -63,7 +63,7 @@ netlink_kernel_create(struct net *net, int unit, struct netlink_kernel_cfg *cfg)
 }
 
 /* this can be increased when necessary - don't expose to userland */
-#define NETLINK_MAX_COOKIE_LEN	20
+#define NETLINK_MAX_COOKIE_LEN	8
 #define NETLINK_MAX_FMTMSG_LEN	80
 
 /**
@@ -212,6 +212,7 @@ static inline void nl_set_extack_cookie_u64(struct netlink_ext_ack *extack,
 {
 	if (!extack)
 		return;
+	BUILD_BUG_ON(sizeof(extack->cookie) < sizeof(cookie));
 	memcpy(extack->cookie, &cookie, sizeof(cookie));
 	extack->cookie_len = sizeof(cookie);
 }
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: netlink: reduce extack cookie size
  2025-05-16 11:59 [PATCH net-next] net: netlink: reduce extack cookie size Johannes Berg
@ 2025-05-16 23:37 ` Jakub Kicinski
  2025-05-20  3:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2025-05-16 23:37 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, netdev, Johannes Berg

On Fri, 16 May 2025 13:59:27 +0200 Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
> 
> 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.)

Reviewed-by: Jakub Kicinski <kuba@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: netlink: reduce extack cookie size
  2025-05-16 11:59 [PATCH net-next] net: netlink: reduce extack cookie size Johannes Berg
  2025-05-16 23:37 ` Jakub Kicinski
@ 2025-05-20  3:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-05-20  3:20 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, netdev, johannes.berg

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 16 May 2025 13:59:27 +0200 you wrote:
> From: Johannes Berg <johannes.berg@intel.com>
> 
> 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.)
> 
> [...]

Here is the summary with links:
  - [net-next] net: netlink: reduce extack cookie size
    https://git.kernel.org/netdev/net-next/c/a462903fa225

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-05-20  3:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-16 11:59 [PATCH net-next] net: netlink: reduce extack cookie size Johannes Berg
2025-05-16 23:37 ` Jakub Kicinski
2025-05-20  3:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).