From: Stephen Boyd <sboyd@kernel.org>
To: Duoming Zhou <duoming@zju.edu.cn>, linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
mturquette@baylibre.com, michal.simek@amd.com,
Duoming Zhou <duoming@zju.edu.cn>
Subject: Re: [PATCH v4] clk: zynq: Prevent null pointer dereference caused by kmalloc failure
Date: Fri, 08 Mar 2024 17:15:37 -0800 [thread overview]
Message-ID: <0fa3332abcf4593376795f52ea145722.sboyd@kernel.org> (raw)
In-Reply-To: <20240301084437.16084-1-duoming@zju.edu.cn>
Quoting Duoming Zhou (2024-03-01 00:44:37)
> The kmalloc() in zynq_clk_setup() will return null if the
> physical memory has run out. As a result, if we use snprintf()
> to write data to the null address, the null pointer dereference
> bug will happen.
>
> This patch uses a stack variable to replace the kmalloc().
>
> Fixes: 0ee52b157b8e ("clk: zynq: Add clock controller driver")
> Suggested-by: Michal Simek <michal.simek@amd.com>
> Suggested-by: Stephen Boyd <sboyd@kernel.org>
> Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
> ---
Applied to clk-next
prev parent reply other threads:[~2024-03-09 1:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-01 8:44 [PATCH v4] clk: zynq: Prevent null pointer dereference caused by kmalloc failure Duoming Zhou
2024-03-01 8:46 ` Michal Simek
2024-03-09 1:15 ` Stephen Boyd [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=0fa3332abcf4593376795f52ea145722.sboyd@kernel.org \
--to=sboyd@kernel.org \
--cc=duoming@zju.edu.cn \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=mturquette@baylibre.com \
/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