lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f0a90f14993aa0fddb87e658be43341b.sboyd@kernel.org>
Date: Wed, 28 Feb 2024 15:07:05 -0800
From: Stephen Boyd <sboyd@...nel.org>
To: Duoming Zhou <duoming@....edu.cn>, linux-kernel@...r.kernel.org
Cc: mturquette@...libre.com, michal.simek@....com, linux-clk@...r.kernel.org, linux-arm-kernel@...ts.infradead.org, Duoming Zhou <duoming@....edu.cn>
Subject: Re: [PATCH] clk: zynq: Prevent null pointer dereference caused by kmalloc failure

Quoting Duoming Zhou (2024-02-13 23:33:18)
> diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c
> index 7bdeaff2bfd..7621c2f0046 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);

Just make a stack variable please. __GFP_NOFAIL is a bad code smell.

>         for (i = 0; i < NUM_MIO_PINS; i++) {
>                 int idx;
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ