[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9a4b653f-6445-f8d3-70c9-91ca9b059839@amd.com>
Date: Wed, 23 Aug 2017 10:39:14 +0200
From: Christian König <christian.koenig@....com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>,
alexander.deucher@....com, airlied@...ux.ie, Monk.Liu@....com,
David1.Zhou@....com, AlexBin.Xie@....com, Jerry.Zhang@....com,
airlied@...hat.com, marek.olsak@....com, john@...tquake.com,
andresx7@...il.com, ray.huang@....com
Cc: amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] drm/amdgpu: check memory allocation failure
Am 23.08.2017 um 07:52 schrieb Christophe JAILLET:
> Check memory allocation failure and return -ENOMEM in such a case.
>
> 'num_post_dep_syncobjs' still has to be set to 0 before the test in order
> to have it initialized if 'amdgpu_cs_parser_fini()' is called to free
> resources.
>
> The calling graph would be, in such a case!
> failure in amdgpu_cs_process_syncobj_out_dep()
> ---> error code returned by amdgpu_cs_dependencies()
> --> amdgpu_cs_parser_fini() is called
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Reviewed-by: Christian König <christian.koenig@....com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index 15d4a28d73bb..baa90df90aea 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -1079,6 +1079,9 @@ static int amdgpu_cs_process_syncobj_out_dep(struct amdgpu_cs_parser *p,
> GFP_KERNEL);
> p->num_post_dep_syncobjs = 0;
>
> + if (!p->post_dep_syncobjs)
> + return -ENOMEM;
> +
> for (i = 0; i < num_deps; ++i) {
> p->post_dep_syncobjs[i] = drm_syncobj_find(p->filp, deps[i].handle);
> if (!p->post_dep_syncobjs[i])
Powered by blists - more mailing lists