[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ec778693-fa10-4907-95f6-3b35bc4e250c@amd.com>
Date: Fri, 1 Mar 2024 08:02:05 +0100
From: Michal Simek <michal.simek@....com>
To: Stephen Boyd <sboyd@...nel.org>, Duoming Zhou <duoming@....edu.cn>,
linux-kernel@...r.kernel.org
Cc: linux-arm-kernel@...ts.infradead.org, linux-clk@...r.kernel.org,
mturquette@...libre.com
Subject: Re: [PATCH v2] clk: zynq: Prevent null pointer dereference caused by
kmalloc failure
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
Powered by blists - more mailing lists