diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index 869bc1093e76e39ddac20977c43d494318a068b0..61a002f5dec6c7c5c9176e571587cb7667dacd34 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -2065,7 +2065,8 @@ static int ethtool_get_phy_stats(struct net_device *dev, void __user *useraddr) return n_stats; if (n_stats > S32_MAX / sizeof(u64)) return -ENOMEM; - WARN_ON_ONCE(!n_stats); + if (WARN_ON_ONCE(!n_stats)) + return -EOPNOTSUPP; if (copy_from_user(&stats, useraddr, sizeof(stats))) return -EFAULT;