mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-11-07 12:48:33 -10:00
fixup! mlx5en: Add sysctl variable mapping driver name to IF name
Mark the new "ifname" sysctl MPSAFE and use strlcpy() so the interface name it returns is always NUL-terminated. Sponsored by: NVidia networking MFC after: 1 month
This commit is contained in:
1 parent
c31002454e
commit
b44da2b82b
1 file changed
+3
-2
@@ -4130,7 +4130,7 @@ sysctl_ifname(SYSCTL_HANDLER_ARGS)
|
||||
char name[IFNAMSIZ];
|
||||
int error;
|
||||
|
||||
strncpy(name, if_name(priv->ifp), sizeof(name));
|
||||
strlcpy(name, if_name(priv->ifp), sizeof(name));
|
||||
error = sysctl_handle_string(oidp, name, sizeof(name), req);
|
||||
return (error);
|
||||
}
|
||||
@@ -4969,7 +4969,8 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev)
|
||||
|
||||
SYSCTL_ADD_PROC(&priv->sysctl_ctx,
|
||||
SYSCTL_CHILDREN(device_get_sysctl_tree(mdev->pdev->dev.bsddev)),
|
||||
OID_AUTO, "ifname", CTLTYPE_STRING | CTLFLAG_RD, priv, 0,
|
||||
OID_AUTO, "ifname", CTLTYPE_STRING | CTLFLAG_RD |
|
||||
CTLFLAG_MPSAFE, priv, 0,
|
||||
sysctl_ifname, "A", "ifname managed by driver");
|
||||
|
||||
return (priv);
|
||||
|
||||
Reference in new issue
Block a user