diff mbox series

[RFC,2/5] net: core: dev.c confirmed to use classic sockaddr

Message ID 20241104222513.3469025-2-kees@kernel.org (mailing list archive)
State RFC
Delegated to: Netdev Maintainers
Headers show
Series sockaddr usage removal | expand

Checks

Context Check Description
netdev/tree_selection success Guessing tree name failed - patch did not apply, async

Commit Message

Kees Cook Nov. 4, 2024, 10:25 p.m. UTC
Add comments about the sockaddr arguments being actual classic "max 14
bytes in sa_data" sockaddr.

Signed-off-by: Kees Cook <kees@kernel.org>
---
 net/core/dev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/net/core/dev.c b/net/core/dev.c
index 582466a0176a..c95779cb42a6 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -9075,7 +9075,8 @@  EXPORT_SYMBOL(dev_pre_changeaddr_notify);
 /**
  *	dev_set_mac_address - Change Media Access Control Address
  *	@dev: device
- *	@sa: new address
+ *	@sa: new address in a classic "struct sockaddr", which will never
+ *	     have more than 14 bytes in @sa::sa_data
  *	@extack: netlink extended ack
  *
  *	Change the hardware (MAC) address of the device
@@ -9109,6 +9110,7 @@  EXPORT_SYMBOL(dev_set_mac_address);
 
 DECLARE_RWSEM(dev_addr_sem);
 
+/* "sa" is a classic sockaddr: it will only ever use 14 bytes from sa_data. */
 int dev_set_mac_address_user(struct net_device *dev, struct sockaddr *sa,
 			     struct netlink_ext_ack *extack)
 {
@@ -9121,6 +9123,7 @@  int dev_set_mac_address_user(struct net_device *dev, struct sockaddr *sa,
 }
 EXPORT_SYMBOL(dev_set_mac_address_user);
 
+/* "sa" is a classic sockaddr: it will only ever use 14 bytes from sa_data. */
 int dev_get_mac_address(struct sockaddr *sa, struct net *net, char *dev_name)
 {
 	size_t size = sizeof(sa->sa_data);