From: zhanglin Date: Sat, 26 Oct 2019 07:54:16 +0000 (+0800) Subject: net: Zeroing the structure ethtool_wolinfo in ethtool_get_wol() X-Git-Tag: v4.9.200~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7b441b2526cc47261bf3400842a3148b087419df;p=platform%2Fkernel%2Flinux-amlogic.git net: Zeroing the structure ethtool_wolinfo in ethtool_get_wol() [ Upstream commit 5ff223e86f5addbfae26419cbb5d61d98f6fbf7d ] memset() the structure ethtool_wolinfo that has padded bytes but the padded bytes have not been zeroed out. Signed-off-by: zhanglin Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/core/ethtool.c b/net/core/ethtool.c index ffe7b03c9ab5..454f73fcb3a6 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -1438,11 +1438,13 @@ static int ethtool_reset(struct net_device *dev, char __user *useraddr) static int ethtool_get_wol(struct net_device *dev, char __user *useraddr) { - struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL }; + struct ethtool_wolinfo wol; if (!dev->ethtool_ops->get_wol) return -EOPNOTSUPP; + memset(&wol, 0, sizeof(struct ethtool_wolinfo)); + wol.cmd = ETHTOOL_GWOL; dev->ethtool_ops->get_wol(dev, &wol); if (copy_to_user(useraddr, &wol, sizeof(wol)))