Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a25d4d93 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: gadget: u_ether: Add NULL check in helper APIs"

parents 986f28aa 2e84872a
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -1073,6 +1073,9 @@ int gether_set_dev_addr(struct net_device *net, const char *dev_addr)
	struct eth_dev *dev;
	u8 new_addr[ETH_ALEN];

	if (!net)
		return -ENODEV;

	dev = netdev_priv(net);
	if (get_ether_addr(dev_addr, new_addr))
		return -EINVAL;
@@ -1085,6 +1088,9 @@ int gether_get_dev_addr(struct net_device *net, char *dev_addr, int len)
{
	struct eth_dev *dev;

	if (!net)
		return -ENODEV;

	dev = netdev_priv(net);
	return get_ether_addr_str(dev->dev_mac, dev_addr, len);
}
@@ -1095,6 +1101,9 @@ int gether_set_host_addr(struct net_device *net, const char *host_addr)
	struct eth_dev *dev;
	u8 new_addr[ETH_ALEN];

	if (!net)
		return -ENODEV;

	dev = netdev_priv(net);
	if (get_ether_addr(host_addr, new_addr))
		return -EINVAL;
@@ -1107,6 +1116,9 @@ int gether_get_host_addr(struct net_device *net, char *host_addr, int len)
{
	struct eth_dev *dev;

	if (!net)
		return -ENODEV;

	dev = netdev_priv(net);
	return get_ether_addr_str(dev->host_mac, host_addr, len);
}
@@ -1139,6 +1151,9 @@ void gether_set_qmult(struct net_device *net, unsigned qmult)
{
	struct eth_dev *dev;

	if (!net)
		return;

	dev = netdev_priv(net);
	dev->qmult = qmult;
}
@@ -1148,6 +1163,9 @@ unsigned gether_get_qmult(struct net_device *net)
{
	struct eth_dev *dev;

	if (!net)
		return -ENODEV;

	dev = netdev_priv(net);
	return dev->qmult;
}
@@ -1155,6 +1173,9 @@ EXPORT_SYMBOL_GPL(gether_get_qmult);

int gether_get_ifname(struct net_device *net, char *name, int len)
{
	if (!net)
		return -ENODEV;

	rtnl_lock();
	strlcpy(name, netdev_name(net), len);
	rtnl_unlock();