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 15:48:30 +0200 [thread overview]
Message-ID: <YoOnrsEAFOclLbG2@kroah.com> (raw)
In-Reply-To: <16959408-3e91-774d-484f-508caff1f8f7@huawei.com>
On Tue, May 17, 2022 at 09:03:43PM +0800, Yang Yingliang wrote:
>
> On 2022/5/17 18:18, Greg KH wrote:
> > 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?
> I can make change and send a patch for this, but I don't have device to test
> it.
For something like this, it would be great to test.
thanks,
greg k-h
prev parent reply other threads:[~2022-05-17 17:59 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
2022-05-17 13:03 ` Yang Yingliang
2022-05-17 13:48 ` Greg KH [this message]
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=YoOnrsEAFOclLbG2@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.