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] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 30 Jun 2021 16:03:02 +0000
From:   Liam Beguin <lvb@...hos.com>
To:     Wang Hai <wanghai38@...wei.com>,
        "mturquette@...libre.com" <mturquette@...libre.com>,
        "sboyd@...nel.org" <sboyd@...nel.org>
CC:     "linux-clk@...r.kernel.org" <linux-clk@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH -next] clk: lmk04832: fix return value check in
 lmk04832_probe()



> -----Original Message-----
> From: Wang Hai <wanghai38@...wei.com>
> Sent: June 29, 2021 10:03 PM
> To: mturquette@...libre.com; sboyd@...nel.org; Liam Beguin
> <lvb@...hos.com>
> Cc: linux-clk@...r.kernel.org; linux-kernel@...r.kernel.org
> Subject: [PATCH -next] clk: lmk04832: fix return value check in
> lmk04832_probe()
> 
> In case of error, the function devm_kzalloc() and devm_kcalloc() return
> NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check
> should be replaced with NULL test.
> 
> Fixes: 3bc61cfd6f4a ("clk: add support for the lmk04832")
> Reported-by: Hulk Robot <hulkci@...wei.com>
> Signed-off-by: Wang Hai <wanghai38@...wei.com>

Reviewed-by: Liam Beguin <lvb@...hos.com>

> ---
>  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 0cd76e626c3..66ad5cbe702 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.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ