From: Stephen Boyd <sboyd@kernel.org>
To: Li zeming <zeming@nfschina.com>,
michal.simek@xilinx.com, mturquette@baylibre.com
Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Li zeming <zeming@nfschina.com>
Subject: Re: [PATCH] zynq: clkc: Add kmalloc allocation flag
Date: Tue, 21 Feb 2023 14:50:20 -0800 [thread overview]
Message-ID: <1e05156120fdfd79ed267f44fe7f3491.sboyd@kernel.org> (raw)
In-Reply-To: <20230222215834.3507-1-zeming@nfschina.com>
Quoting Li zeming (2023-02-22 13:58:34)
> The kmalloc could crash if allocation fails. Add the __GFP_NOFAIL flag
> to ensure that allocation succeeds every time.
>
> Signed-off-by: Li zeming <zeming@nfschina.com>
> ---
> drivers/clk/zynq/clkc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c
> index 7bdeaff2bfd6..7621c2f00468 100644
> --- a/drivers/clk/zynq/clkc.c
> +++ b/drivers/clk/zynq/clkc.c
> @@ -427,7 +427,7 @@ static void __init zynq_clk_setup(struct device_node *np)
> SLCR_GEM1_CLK_CTRL, 0, 0, &gem1clk_lock);
>
> tmp = strlen("mio_clk_00x");
> - clk_name = kmalloc(tmp, GFP_KERNEL);
> + clk_name = kmalloc(tmp, GFP_KERNEL | __GFP_NOFAIL);
There are so many more allocations happening in this function and they
aren't marked nofail. Why is this one special?
I could see a patch moving mio_clk_00x to the stack and then printing to
it. But it is also fine like this, so I don't see any reason to change
this.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-02-21 22:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-22 21:58 [PATCH] zynq: clkc: Add kmalloc allocation flag Li zeming
2023-02-21 22:50 ` Stephen Boyd [this message]
2023-02-23 18:33 ` Li zeming
2023-02-27 14:38 ` Michal Simek
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=1e05156120fdfd79ed267f44fe7f3491.sboyd@kernel.org \
--to=sboyd@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@xilinx.com \
--cc=mturquette@baylibre.com \
--cc=zeming@nfschina.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;
as well as URLs for NNTP newsgroup(s).