2019-05-09 08:23:47

by Tomeu Vizoso

[permalink] [raw]
Subject: [PATCH] drm/panfrost: Only put sync_out if non-NULL

Dan Carpenter's static analysis tool reported:

drivers/gpu/drm/panfrost/panfrost_drv.c:222 panfrost_ioctl_submit()
error: we previously assumed 'sync_out' could be null (see line 216)

Indeed, sync_out could be NULL if userspace doesn't send a sync object
ID for the out fence.

Signed-off-by: Tomeu Vizoso <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Link: https://lists.freedesktop.org/archives/dri-devel/2019-May/217014.html
---
drivers/gpu/drm/panfrost/panfrost_drv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index 94b0819ad50b..d11e2281dde6 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -219,7 +219,8 @@ static int panfrost_ioctl_submit(struct drm_device *dev, void *data,
fail_job:
panfrost_job_put(job);
fail_out_sync:
- drm_syncobj_put(sync_out);
+ if (sync_out)
+ drm_syncobj_put(sync_out);

return ret;
}
--
2.20.1


2019-05-09 16:26:13

by Steven Price

[permalink] [raw]
Subject: Re: [PATCH] drm/panfrost: Only put sync_out if non-NULL

On 09/05/2019 09:21, Tomeu Vizoso wrote:
> Dan Carpenter's static analysis tool reported:
>
> drivers/gpu/drm/panfrost/panfrost_drv.c:222 panfrost_ioctl_submit()
> error: we previously assumed 'sync_out' could be null (see line 216)
>
> Indeed, sync_out could be NULL if userspace doesn't send a sync object
> ID for the out fence.
>
> Signed-off-by: Tomeu Vizoso <[email protected]>
> Reported-by: Dan Carpenter <[email protected]>
> Link: https://lists.freedesktop.org/archives/dri-devel/2019-May/217014.html

Reviewed-by: Steven Price <[email protected]>

> ---
> drivers/gpu/drm/panfrost/panfrost_drv.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
> index 94b0819ad50b..d11e2281dde6 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_drv.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
> @@ -219,7 +219,8 @@ static int panfrost_ioctl_submit(struct drm_device *dev, void *data,
> fail_job:
> panfrost_job_put(job);
> fail_out_sync:
> - drm_syncobj_put(sync_out);
> + if (sync_out)
> + drm_syncobj_put(sync_out);
>
> return ret;
> }
>

2019-05-13 18:35:27

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH] drm/panfrost: Only put sync_out if non-NULL

On Thu, May 9, 2019 at 3:22 AM Tomeu Vizoso <[email protected]> wrote:
>
> Dan Carpenter's static analysis tool reported:
>
> drivers/gpu/drm/panfrost/panfrost_drv.c:222 panfrost_ioctl_submit()
> error: we previously assumed 'sync_out' could be null (see line 216)
>
> Indeed, sync_out could be NULL if userspace doesn't send a sync object
> ID for the out fence.
>
> Signed-off-by: Tomeu Vizoso <[email protected]>
> Reported-by: Dan Carpenter <[email protected]>
> Link: https://lists.freedesktop.org/archives/dri-devel/2019-May/217014.html
> ---
> drivers/gpu/drm/panfrost/panfrost_drv.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)

Applied.

Rob