From: "Arnd Bergmann" <arnd@arndb.de>
To: "Jiasheng Jiang" <jiasheng@iscas.ac.cn>,
"Oded Gabbay" <ogabbay@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
ttayar@habana.ai, dliberman@habana.ai, obitton@habana.ai,
osharabi@habana.ai, dhirschfeld@habana.ai
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] habanalabs: Fix freeing uninitialized pointers
Date: Wed, 08 Feb 2023 08:21:58 +0100 [thread overview]
Message-ID: <ce2301d2-2bdc-423a-9501-bc45951bb52a@app.fastmail.com> (raw)
In-Reply-To: <20230208070559.19589-1-jiasheng@iscas.ac.cn>
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@iscas.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
prev parent reply other threads:[~2023-02-08 7:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-08 7:05 Jiasheng Jiang
2023-02-08 7:21 ` Arnd Bergmann [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=ce2301d2-2bdc-423a-9501-bc45951bb52a@app.fastmail.com \
--to=arnd@arndb.de \
--cc=dhirschfeld@habana.ai \
--cc=dliberman@habana.ai \
--cc=gregkh@linuxfoundation.org \
--cc=jiasheng@iscas.ac.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=obitton@habana.ai \
--cc=ogabbay@kernel.org \
--cc=osharabi@habana.ai \
--cc=ttayar@habana.ai \
/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
all inboxes | Powered by JetHome®