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: <YnuKXrcAojBAiCsN@kroah.com>
Date:   Wed, 11 May 2022 12:05:18 +0200
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Yang Yingliang <yangyingliang@...wei.com>
Cc:     linux-kernel@...r.kernel.org, linux-hwmon@...r.kernel.org,
        zbr@...emap.net, jdelvare@...e.com, linux@...ck-us.net
Subject: Re: [PATCH -next] drivers: w1: use kfree_sensitive()

On Wed, May 11, 2022 at 03:25:52PM +0800, Yang Yingliang wrote:
> Hi,
> 
> On 2022/5/11 14:45, Greg KH wrote:
> > On Wed, May 11, 2022 at 02:49:54PM +0800, Yang Yingliang wrote:
> > > Use kfree_sensitive() instead of open-coding it.
> > > 
> > > Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
> > > ---
> > >   drivers/w1/w1.c | 3 +--
> > >   1 file changed, 1 insertion(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
> > > index f2ae2e563dc5..a0a6c3c739d9 100644
> > > --- a/drivers/w1/w1.c
> > > +++ b/drivers/w1/w1.c
> > > @@ -73,8 +73,7 @@ static void w1_master_release(struct device *dev)
> > >   	struct w1_master *md = dev_to_w1_master(dev);
> > >   	dev_dbg(dev, "%s: Releasing %s.\n", __func__, md->name);
> > > -	memset(md, 0, sizeof(struct w1_master) + sizeof(struct w1_bus_master));
> > > -	kfree(md);
> > > +	kfree_sensitive(md);
> > Does this actually change anything?  Why is the memset being called here
> > at all?
> It's no functional change and I got this by
> scripts/coccinelle/api/kfree_sensitive.cocci.

That's an odd rule, and as you can see here, not always correct or
needed.

> I'm not sure why using memset() here.

Then let's not make this change without figuring that out first please.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ