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, 25 Nov 2021 15:25:38 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Kyle Copperfield <kmcopper@...win1210.me>
Cc:     Ezequiel Garcia <ezequiel@...labora.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Heiko Stuebner <heiko@...ech.de>,
        Dragan Simic <dragan.simic@...il.com>,
        linux-media@...r.kernel.org, linux-rockchip@...ts.infradead.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] media: rockchip/rga: do proper error checking in probe

On Sat, Nov 20, 2021 at 12:23:02PM +0000, Kyle Copperfield wrote:
> The latest fix for probe error handling contained a typo that causes
> probing to fail with the following message:
> 
>   rockchip-rga: probe of ff680000.rga failed with error -12
> 
> This patch fixes the typo.
> 
> Fixes: e58430e1d4fd (media: rockchip/rga: fix error handling in probe)
> Reviewed-by: Dragan Simic <dragan.simic@...il.com>
> Signed-off-by: Kyle Copperfield <kmcopper@...win1210.me>
> ---
>  drivers/media/platform/rockchip/rga/rga.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/platform/rockchip/rga/rga.c
> index 6759091b15e0..d99ea8973b67 100644
> --- a/drivers/media/platform/rockchip/rga/rga.c
> +++ b/drivers/media/platform/rockchip/rga/rga.c
> @@ -895,7 +895,7 @@ static int rga_probe(struct platform_device *pdev)
>  	}
>  	rga->dst_mmu_pages =
>  		(unsigned int *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 3);
> -	if (rga->dst_mmu_pages) {
> +	if (!rga->dst_mmu_pages) {
>  		ret = -ENOMEM;
>  		goto free_src_pages;
>  	}

There was supposed to be Smatch warning to catch this bug but Smatch was
not parsing __get_free_pages() correctly.  I've fixed that so it
generates a warning now.

drivers/media/platform/rockchip/rga/rga.c:928 rga_probe() warn: 'rga->dst_mmu_pages' from __get_free_pages() not released on lines: 928.

Also I have introduced a new checker warning for code like:

	foo = alloc();
	if (foo)
		ret = -ENOMEM;

drivers/media/platform/rockchip/rga/rga.c:896 rga_probe() warn: inverted NULL check

I will test that out tonight.  I've also created a warning for if we
return success when a function returns NULL but I'm not really
optimistic that it will work.  Still, you never know until you check so
I'll test that out as well.

drivers/media/platform/rockchip/rga/rga.c:912 rga_probe() warn: success when 'rga->dst_mmu_pages' is NULL'

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ