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: <YQBPR0101MB18115B033E3F961CDF45C199D8019@YQBPR0101MB1811.CANPRD01.PROD.OUTLOOK.COM>
Date:   Wed, 30 Jun 2021 16:00:28 +0000
From:   Liam Beguin <lvb@...hos.com>
To:     Dan Carpenter <dan.carpenter@...cle.com>,
        Michael Turquette <mturquette@...libre.com>
CC:     Stephen Boyd <sboyd@...nel.org>,
        "linux-clk@...r.kernel.org" <linux-clk@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>
Subject: RE: [PATCH] clk: lmk04832: fix checks for allocation failure

Hi Dan,

> -----Original Message-----
> From: Dan Carpenter <dan.carpenter@...cle.com>
> Sent: June 30, 2021 9:50 AM
> To: Michael Turquette <mturquette@...libre.com>; Liam Beguin
> <lvb@...hos.com>
> Cc: Stephen Boyd <sboyd@...nel.org>; linux-clk@...r.kernel.org; linux-
> kernel@...r.kernel.org; kernel-janitors@...r.kernel.org
> Subject: [PATCH] clk: lmk04832: fix checks for allocation failure
> 
> The devm_kcalloc() function returns NULL on error, it never returns
> error pointers so these conditions need to be fixed.
> 
> Fixes: 3bc61cfd6f4a ("clk: add support for the lmk04832")
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>

A similar patch was posted earlier yesterday. See [1] 

[1] https://patchwork.kernel.org/project/linux-clk/patch/20210630020322.2555946-1-wanghai38@huawei.com/

Liam

> ---
>  drivers/clk/clk-lmk04832.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/clk/clk-lmk04832.c b/drivers/clk/clk-lmk04832.c
> index 0cd76e626c3d..66ad5cbe7029 100644
> --- a/drivers/clk/clk-lmk04832.c
> +++ b/drivers/clk/clk-lmk04832.c
> @@ -1425,23 +1425,23 @@ static int lmk04832_probe(struct spi_device
> *spi)
> 
>  	lmk->dclk = devm_kcalloc(lmk->dev, info->num_channels >> 1,
>  				 sizeof(struct lmk_dclk), GFP_KERNEL);
> -	if (IS_ERR(lmk->dclk)) {
> -		ret = PTR_ERR(lmk->dclk);
> +	if (!lmk->dclk) {
> +		ret = -ENOMEM;
>  		goto err_disable_oscin;
>  	}
> 
>  	lmk->clkout = devm_kcalloc(lmk->dev, info->num_channels,
>  				   sizeof(*lmk->clkout), GFP_KERNEL);
> -	if (IS_ERR(lmk->clkout)) {
> -		ret = PTR_ERR(lmk->clkout);
> +	if (!lmk->clkout) {
> +		ret = -ENOMEM;
>  		goto err_disable_oscin;
>  	}
> 
>  	lmk->clk_data = devm_kzalloc(lmk->dev, struct_size(lmk->clk_data,
> hws,
>  							   info-
> >num_channels),
>  				     GFP_KERNEL);
> -	if (IS_ERR(lmk->clk_data)) {
> -		ret = PTR_ERR(lmk->clk_data);
> +	if (!lmk->clk_data) {
> +		ret = -ENOMEM;
>  		goto err_disable_oscin;
>  	}
> 
> --
> 2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ