From: Greg KH <gregkh@linuxfoundation.org>
To: Yang Yingliang <yangyingliang@huawei.com>
Cc: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org,
zbr@ioremap.net, jdelvare@suse.com, linux@roeck-us.net
Subject: Re: [PATCH -next] drivers: w1: use kfree_sensitive()
Date: Tue, 17 May 2022 12:18:38 +0200 [thread overview]
Message-ID: <YoN2fn5zRyNEnaUT@kroah.com> (raw)
In-Reply-To: <2cf24169-ea56-9c72-fa95-a1e6625c8545@huawei.com>
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@huawei.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.
> I'm not sure why using memset() here.
I think the memset() can just be dropped. Can you make that change and
test it to verify it still works properly with that change?
thanks,
greg k-h
next prev parent reply other threads:[~2022-05-17 10:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-11 6:49 [PATCH -next] drivers: w1: use kfree_sensitive() Yang Yingliang
2022-05-11 6:45 ` Greg KH
2022-05-11 7:25 ` Yang Yingliang
2022-05-11 10:05 ` Greg KH
2022-05-17 10:18 ` Greg KH [this message]
2022-05-17 13:03 ` Yang Yingliang
2022-05-17 13:48 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YoN2fn5zRyNEnaUT@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=yangyingliang@huawei.com \
--cc=zbr@ioremap.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).