Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ethtool: propagate get_coalesce return value

get_coalesce returns 0 or ERRNO, but the return value isn't checked.
The returned coalesce data may be invalid if an ERRNO is set,
therefore better check and propagate the return value.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Heiner Kallweit and committed by
David S. Miller
31610711 c0096a28

+4 -1
+4 -1
net/ethtool/ioctl.c
··· 1510 1510 void __user *useraddr) 1511 1511 { 1512 1512 struct ethtool_coalesce coalesce = { .cmd = ETHTOOL_GCOALESCE }; 1513 + int ret; 1513 1514 1514 1515 if (!dev->ethtool_ops->get_coalesce) 1515 1516 return -EOPNOTSUPP; 1516 1517 1517 - dev->ethtool_ops->get_coalesce(dev, &coalesce); 1518 + ret = dev->ethtool_ops->get_coalesce(dev, &coalesce); 1519 + if (ret) 1520 + return ret; 1518 1521 1519 1522 if (copy_to_user(useraddr, &coalesce, sizeof(coalesce))) 1520 1523 return -EFAULT;