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]
Message-ID: <20240402143337.38e864e9@collabora.com>
Date: Tue, 2 Apr 2024 14:33:37 +0200
From: Boris Brezillon <boris.brezillon@...labora.com>
To: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
Cc: Steven Price <steven.price@....com>, Liviu Dudau <liviu.dudau@....com>,
 Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, Maxime Ripard
 <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>, David Airlie
 <airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>, Heiko Stuebner
 <heiko@...ech.de>, dri-devel@...ts.freedesktop.org,
 linux-kernel@...r.kernel.org, dan.carpenter@...aro.org,
 kernel-janitors@...r.kernel.org, error27@...il.com
Subject: Re: [PATCH] drm/panthor: Fix NULL vs IS_ERR() bug in
 panthor_ioctl_tiler_heap_destroy()

Hello Harshit,

On Tue,  2 Apr 2024 03:33:58 -0700
Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com> wrote:

> panthor_vm_get_heap_pool() returns ERR_PTR on failure.
> 
> Fixes: 4bdca1150792 ("drm/panthor: Add the driver frontend block")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
> ---
> This is spotted by smatch and the patch is only compile tested
> ---
>  drivers/gpu/drm/panthor/panthor_drv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
> index 11b3ccd58f85..050b905b0453 100644
> --- a/drivers/gpu/drm/panthor/panthor_drv.c
> +++ b/drivers/gpu/drm/panthor/panthor_drv.c
> @@ -1090,8 +1090,8 @@ static int panthor_ioctl_tiler_heap_destroy(struct drm_device *ddev, void *data,
>  		return -EINVAL;
>  
>  	pool = panthor_vm_get_heap_pool(vm, false);
> -	if (!pool) {
> -		ret = -EINVAL;
> +	if (IS_ERR(pool)) {
> +		ret = PTR_ERR(pool);

Actually, panthor_vm_get_heap_pool() will return NULL if there's no
heap pool attached to this VM and create=false, so this was correct.
This being said, I'm fine making that consistent by returning
ERR_PTR(-ENOENT) instead of NULL in that case. This way we don't have
two different semantics based on the 'create' value.

Oh, and please merge everything into a single patch instead of one patch
per call-site.

Regards,

Boris

>  		goto out_put_vm;
>  	}
>  


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ