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]
Date:   Thu, 10 Aug 2023 21:30:14 +0800
From:   suijingfeng <suijingfeng@...ngson.cn>
To:     Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>,
        David Airlie <airlied@...il.com>,
        Daniel Vetter <daniel@...ll.ch>,
        Thomas Zimmermann <tzimmermann@...e.de>,
        dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Cc:     dan.carpenter@...aro.org, kernel-janitors@...r.kernel.org,
        error27@...il.com
Subject: Re: [PATCH next] drm/loongson: Fix error handling in
 lsdc_pixel_pll_setup()

Hi,


On 2023/7/20 20:39, Harshit Mogalapalli wrote:
> There are two problems in lsdc_pixel_pll_setup()
> 1. If kzalloc() fails then call iounmap() to release the resources.
> 2. Both kzalloc and ioremap doesnot return error pointers on failure, so
>     using IS_ERR_OR_NULL() checks is a bit confusing and not very right,
>     fix this by changing those to NULL checks instead.
>
> Fixes: f39db26c5428 ("drm: Add kms driver for loongson display controller")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>


Reviewed-by: Sui Jingfeng <suijingfeng@...ngson.cn>


> ---
> This is found with static analysis with smacth and only compile tested.
> ---
>   drivers/gpu/drm/loongson/lsdc_pixpll.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/loongson/lsdc_pixpll.c b/drivers/gpu/drm/loongson/lsdc_pixpll.c
> index 04c15b4697e2..2609a2256da4 100644
> --- a/drivers/gpu/drm/loongson/lsdc_pixpll.c
> +++ b/drivers/gpu/drm/loongson/lsdc_pixpll.c
> @@ -120,12 +120,14 @@ static int lsdc_pixel_pll_setup(struct lsdc_pixpll * const this)
>   	struct lsdc_pixpll_parms *pparms;
>   
>   	this->mmio = ioremap(this->reg_base, this->reg_size);
> -	if (IS_ERR_OR_NULL(this->mmio))
> +	if (!this->mmio)
>   		return -ENOMEM;
>   
>   	pparms = kzalloc(sizeof(*pparms), GFP_KERNEL);
> -	if (IS_ERR_OR_NULL(pparms))
> +	if (!pparms) {
> +		iounmap(this->mmio);
>   		return -ENOMEM;
> +	}
>   
>   	pparms->ref_clock = LSDC_PLL_REF_CLK_KHZ;
>   

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ