lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bc150c6a-6d3e-ff01-e40e-840e8a385bda@metux.net>
Date:   Thu, 21 Nov 2019 11:23:34 +0100
From:   "Enrico Weigelt, metux IT consult" <lkml@...ux.net>
To:     Joe Perches <joe@...ches.com>, zhanglin <zhang.lin16@....com.cn>,
        davem@...emloft.net, cocci <cocci@...teme.lip6.fr>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     mkubecek@...e.cz, jakub.kicinski@...ronome.com, ast@...nel.org,
        jiang.xuexin@....com.cn, f.fainelli@...il.com,
        daniel@...earbox.net, john.fastabend@...il.com,
        lirongqing@...du.com, maxime.chevallier@...tlin.com,
        vivien.didelot@...il.com, dan.carpenter@...cle.com,
        wang.yi59@....com.cn, hawk@...nel.org, arnd@...db.de,
        jiri@...lanox.com, xue.zhihong@....com.cn,
        natechancellor@...il.com, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, linyunsheng@...wei.com,
        pablo@...filter.org, bpf@...r.kernel.org
Subject: Re: [Cocci] [PATCH] net: Zeroing the structure ethtool_wolinfo in
 ethtool_get_wol()

On 26.10.19 21:40, Joe Perches wrote:
> On Sat, 2019-10-26 at 15:54 +0800, zhanglin wrote:
>> memset() the structure ethtool_wolinfo that has padded bytes
>> but the padded bytes have not been zeroed out.
> []
>> diff --git 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)))
> 
> It seems likely there are more of these.
> 
> Is there any way for coccinelle to find them?

Just curios: is static struct initialization (on stack) something that
should be avoided ? I've been under the impression that static
initialization allows thinner code and gives the compiler better chance
for optimizations.


--mtx

---
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
info@...ux.net -- +49-151-27565287

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ