Skip to content

Commit 5ff223e

Browse files
zhanglindavem330
authored andcommitted
net: Zeroing the structure ethtool_wolinfo in ethtool_get_wol()
memset() the structure ethtool_wolinfo that has padded bytes but the padded bytes have not been zeroed out. Signed-off-by: zhanglin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7c3bebc commit 5ff223e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/core/ethtool.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1396,11 +1396,13 @@ static int ethtool_reset(struct net_device *dev, char __user *useraddr)
13961396

13971397
static int ethtool_get_wol(struct net_device *dev, char __user *useraddr)
13981398
{
1399-
struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };
1399+
struct ethtool_wolinfo wol;
14001400

14011401
if (!dev->ethtool_ops->get_wol)
14021402
return -EOPNOTSUPP;
14031403

1404+
memset(&wol, 0, sizeof(struct ethtool_wolinfo));
1405+
wol.cmd = ETHTOOL_GWOL;
14041406
dev->ethtool_ops->get_wol(dev, &wol);
14051407

14061408
if (copy_to_user(useraddr, &wol, sizeof(wol)))

0 commit comments

Comments
 (0)