public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@amd.com>
To: Stephen Boyd <sboyd@kernel.org>,
	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
Subject: Re: [PATCH v2] clk: zynq: Prevent null pointer dereference caused by kmalloc failure
Date: Fri, 1 Mar 2024 08:02:05 +0100	[thread overview]
Message-ID: <ec778693-fa10-4907-95f6-3b35bc4e250c@amd.com> (raw)
In-Reply-To: <6bfce5ec26a26c327c4196dbe57b63d5.sboyd@kernel.org>



On 3/1/24 02:21, Stephen Boyd wrote:
> Quoting Michal Simek (2024-02-29 04:45:54)
>> On 2/29/24 13:22, Duoming Zhou wrote:
>>> diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c
>>> index 7bdeaff2bfd..e4c4c9adf79 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);
>>> +     char clk_name[tmp];
>>
>> I know that Stephen asked for it but variable with variable length in the middle
>> of code doesn't look good or useful.
> 
> I didn't ask for it to be in the middle of the function :)

I didn't say it. :-)
I know it was about putting it on the stack instead.

M


      reply	other threads:[~2024-03-01  7:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-29 12:22 [PATCH v2] clk: zynq: Prevent null pointer dereference caused by kmalloc failure Duoming Zhou
2024-02-29 12:45 ` Michal Simek
2024-02-29 14:16   ` duoming
2024-03-01  1:22     ` Stephen Boyd
2024-03-01  1:21   ` Stephen Boyd
2024-03-01  7:02     ` Michal Simek [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=ec778693-fa10-4907-95f6-3b35bc4e250c@amd.com \
    --to=michal.simek@amd.com \
    --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=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    /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