Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp439473ybg; Sat, 26 Oct 2019 00:53:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqxzKw1p0hxp/bCrffq6h+oCV4Xjpg78yjMatuY51X3F9+rcZcHWLz8AzgE3BicGDTxtUQMV X-Received: by 2002:a50:9b43:: with SMTP id a3mr5403900edj.73.1572076394520; Sat, 26 Oct 2019 00:53:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572076394; cv=none; d=google.com; s=arc-20160816; b=Ificy8Lv7ZK28lG4Zf5Evabqz36wAyBM7nc1mp7BgMGIzfZA9NKcj2tnRlFAsNKWAI BFXGVR8QNwfRt2TZx3DwZrnnfl/K0nKelN8rQRGiPEYEKvl09nfIGnDZyWOauRweGJl6 aou94pHV4EUPHZcLEgRJGROqKQcdhB7eL+b0hp6DC69WNDgXfCqIZF8Xud3w6mBcObXm hWZEIqLnl9/To4zhESjfXn+5w4QyJHIctUcB7F7UOJVEoQh9VoRtw/H7sE3jA619yxsZ 9NBuFoe2xlE1oWEa5OWal/3Qup3Xe8DrJIq7vOXuoyVA/GyTr/x4mTooj60xcyf7mA16 ltvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=NYtll/m1+CzKTA43O4ifW0HStRP9jO5Ws2YEUWhbdGM=; b=eNVmDLBGQKR5TMIg304P6wSRWq1K+MpI7MDCys6JYNcznZwdHpA65DC8mAIK0sW83m rpA6ZNplCCt0FOJfJxxvWbQ5u8yvP6vyex/DDzLi1/SIl70IucvWpVZPKiL9CtQ+DcVx aWxOsHhXwn7QXN0n+QlojIw0zUtJUvmPBhHQR7J2Pjz4pWZ7rXpWBiI3nDqd6HQlsGTc jl0v/YAiOwvN0ueSYu8t2XicLd/fbzTggLeLNT4yS7zxUhG+odC2ezookpwMBg1gop0P uHZINI69SXhRNqg887Hz/sZMk7Or0ysci+5BNrbpk+IzyzhEBC/6JhdIs64GcxwqqYrj CouA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e6si3664998edc.238.2019.10.26.00.52.51; Sat, 26 Oct 2019 00:53:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726171AbfJZHwV (ORCPT + 99 others); Sat, 26 Oct 2019 03:52:21 -0400 Received: from mxhk.zte.com.cn ([63.217.80.70]:60902 "EHLO mxhk.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725996AbfJZHwV (ORCPT ); Sat, 26 Oct 2019 03:52:21 -0400 Received: from mse-fl2.zte.com.cn (unknown [10.30.14.239]) by Forcepoint Email with ESMTPS id DAD3DE01D7A104C0546D; Sat, 26 Oct 2019 15:52:16 +0800 (CST) Received: from notes_smtp.zte.com.cn (notes_smtp.zte.com.cn [10.30.1.239]) by mse-fl2.zte.com.cn with ESMTP id x9Q7q3oK076541; Sat, 26 Oct 2019 15:52:03 +0800 (GMT-8) (envelope-from zhang.lin16@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019102615524640-139284 ; Sat, 26 Oct 2019 15:52:46 +0800 From: zhanglin To: davem@davemloft.net Cc: ast@kernel.org, daniel@iogearbox.net, jakub.kicinski@netronome.com, hawk@kernel.org, john.fastabend@gmail.com, mkubecek@suse.cz, jiri@mellanox.com, pablo@netfilter.org, f.fainelli@gmail.com, maxime.chevallier@bootlin.com, lirongqing@baidu.com, vivien.didelot@gmail.com, linyunsheng@huawei.com, natechancellor@gmail.com, arnd@arndb.de, dan.carpenter@oracle.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, xue.zhihong@zte.com.cn, wang.yi59@zte.com.cn, jiang.xuexin@zte.com.cn, zhanglin Subject: [PATCH] net: Zeroing the structure ethtool_wolinfo in ethtool_get_wol() Date: Sat, 26 Oct 2019 15:54:16 +0800 Message-Id: <1572076456-12463-1-git-send-email-zhang.lin16@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-10-26 15:52:46, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-10-26 15:52:09, Serialize complete at 2019-10-26 15:52:09 X-MAIL: mse-fl2.zte.com.cn x9Q7q3oK076541 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org memset() the structure ethtool_wolinfo that has padded bytes but the padded bytes have not been zeroed out. Signed-off-by: zhanglin --- 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