Skip to content

Commit 7da6117

Browse files
keesPaolo Abeni
authored andcommitted
ieee802154: Use struct sockaddr_storage with dev_set_mac_address()
Switch to struct sockaddr_storage for calling dev_set_mac_address(). Add a temporary cast to struct sockaddr, which will be removed in a subsequent patch. Acked-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Kees Cook <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent db586ca commit 7da6117

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

net/ieee802154/nl-phy.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,17 +224,17 @@ int ieee802154_add_iface(struct sk_buff *skb, struct genl_info *info)
224224
dev_hold(dev);
225225

226226
if (info->attrs[IEEE802154_ATTR_HW_ADDR]) {
227-
struct sockaddr addr;
227+
struct sockaddr_storage addr;
228228

229-
addr.sa_family = ARPHRD_IEEE802154;
230-
nla_memcpy(&addr.sa_data, info->attrs[IEEE802154_ATTR_HW_ADDR],
229+
addr.ss_family = ARPHRD_IEEE802154;
230+
nla_memcpy(&addr.__data, info->attrs[IEEE802154_ATTR_HW_ADDR],
231231
IEEE802154_ADDR_LEN);
232232

233233
/* strangely enough, some callbacks (inetdev_event) from
234234
* dev_set_mac_address require RTNL_LOCK
235235
*/
236236
rtnl_lock();
237-
rc = dev_set_mac_address(dev, &addr, NULL);
237+
rc = dev_set_mac_address(dev, (struct sockaddr *)&addr, NULL);
238238
rtnl_unlock();
239239
if (rc)
240240
goto dev_unregister;

0 commit comments

Comments
 (0)