[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2024061726-payment-editor-7431@gregkh>
Date: Mon, 17 Jun 2024 20:14:50 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Zijun Hu <quic_zijuhu@...cinc.com>
Cc: rafael@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] devres: Initialize a uninitialized struct member
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?)
If so, what commit does this fix?
thanks,
greg k-h
Powered by blists - more mailing lists