bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: Zeroing the structure ethtool_wolinfo in ethtool_get_wol()
@ 2019-10-26  7:54 zhanglin
  2019-10-26 14:24 ` Dan Carpenter
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: zhanglin @ 2019-10-26  7:54 UTC (permalink / raw)
  To: davem
  Cc: ast, daniel, jakub.kicinski, hawk, john.fastabend, mkubecek,
	jiri, pablo, f.fainelli, maxime.chevallier, lirongqing,
	vivien.didelot, linyunsheng, natechancellor, arnd, dan.carpenter,
	netdev, linux-kernel, bpf, xue.zhihong, wang.yi59, jiang.xuexin,
	zhanglin

memset() the structure ethtool_wolinfo that has padded bytes
but the padded bytes have not been zeroed out.

Signed-off-by: zhanglin <zhang.lin16@zte.com.cn>
---
 net/core/ethtool.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index aeabc48..563a845 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -1471,11 +1471,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)))
-- 
2.15.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-11-21 20:40 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-26  7:54 [PATCH] net: Zeroing the structure ethtool_wolinfo in ethtool_get_wol() zhanglin
2019-10-26 14:24 ` Dan Carpenter
2019-10-26 15:52   ` Joe Perches
2019-10-26 18:21 ` David Miller
2019-10-26 19:40 ` Joe Perches
2019-10-26 20:17   ` [Cocci] " Julia Lawall
2019-11-21 10:23   ` Enrico Weigelt, metux IT consult
2019-11-21 11:19     ` Michal Kubecek
2019-11-21 11:58       ` Julia Lawall
2019-11-21 12:07       ` Dan Carpenter
2019-11-21 13:38         ` Michal Kubecek
2019-11-21 20:40           ` Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).