[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d029d754-aeb7-493a-8e48-6acaa53fee1e@quicinc.com>
Date: Tue, 18 Jun 2024 19:29:59 +0800
From: quic_zijuhu <quic_zijuhu@...cinc.com>
To: Greg KH <gregkh@...uxfoundation.org>
CC: <rafael@...nel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1] devres: Initialize a uninitialized struct member
On 6/18/2024 2:14 AM, Greg KH wrote:
> On Mon, Jun 17, 2024 at 09:09:25PM +0800, Zijun Hu wrote:
>> Use memset() after kmalloc() a struct devres_group to initialize
>> potential uninitialized members such as @color within kernel API
>> devres_open_group() as alloc_dr() does.
>>
>> Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
>> ---
>> drivers/base/devres.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/base/devres.c b/drivers/base/devres.c
>> index 3df0025d12aa..ba3e4603cd77 100644
>> --- a/drivers/base/devres.c
>> +++ b/drivers/base/devres.c
>> @@ -558,6 +558,10 @@ void * devres_open_group(struct device *dev, void *id, gfp_t gfp)
>> if (unlikely(!grp))
>> return NULL;
>>
>> + /* No need to clear memory twice */
>> + if (!(gfp & __GFP_ZERO))
>> + memset(grp, 0, sizeof(*grp));
>
> Is this an actual bugfix (i.e. do we have uninitialized fields today?)
>
no, maybe take it as code optimization instead of bugfix.
yes, field grp->color is NOT initialized.
> If so, what commit does this fix?
>
> thanks,
>
> greg k-h
Powered by blists - more mailing lists