[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <ce2301d2-2bdc-423a-9501-bc45951bb52a@app.fastmail.com>
Date: Wed, 08 Feb 2023 08:21:58 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Jiasheng Jiang" <jiasheng@...as.ac.cn>,
"Oded Gabbay" <ogabbay@...nel.org>,
"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
ttayar@...ana.ai, dliberman@...ana.ai, obitton@...ana.ai,
osharabi@...ana.ai, dhirschfeld@...ana.ai
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] habanalabs: Fix freeing uninitialized pointers
On Wed, Feb 8, 2023, at 08:05, Jiasheng Jiang wrote:
> As the memory allocated by kcalloc has not been set to zero, it may
> contain uninitialized pointers.
> Therefore, free the non-NULL pointers may cause undefined behaviour.
>
> Fixes: 5574cb2194b1 ("habanalabs: Assign each CQ with its own work queue")
> Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
Did you run into a bug here or find that by inspection?
kcalloc() is definitely meant to return zeroed memory, so I don't see
a bug here:
static inline __alloc_size(1, 2) void *kcalloc(size_t n, size_t size, gfp_t flags)
{
return kmalloc_array(n, size, flags | __GFP_ZERO);
}
Arnd
Powered by blists - more mailing lists