Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1718062 > unrolled thread
| Started by | Christophe JAILLET <christophe.jaillet@wanadoo.fr> |
|---|---|
| First post | 2017-08-23 08:10 +0200 |
| Last post | 2017-08-24 20:30 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] drm/amdgpu: check memory allocation failure Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-08-23 08:10 +0200
Re: [PATCH] drm/amdgpu: check memory allocation failure Alex Deucher <alexdeucher@gmail.com> - 2017-08-24 20:30 +0200
| From | Christophe JAILLET <christophe.jaillet@wanadoo.fr> |
|---|---|
| Date | 2017-08-23 08:10 +0200 |
| Subject | [PATCH] drm/amdgpu: check memory allocation failure |
| Message-ID | <uhx1w-5kg-13@gated-at.bofh.it> |
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@wanadoo.fr>
---
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])
--
2.11.0
[toc] | [next] | [standalone]
| From | Alex Deucher <alexdeucher@gmail.com> |
|---|---|
| Date | 2017-08-24 20:30 +0200 |
| Message-ID | <ui53d-1DE-15@gated-at.bofh.it> |
| In reply to | #1718062 |
On Wed, Aug 23, 2017 at 4:39 AM, Christian König
<christian.koenig@amd.com> wrote:
> 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@wanadoo.fr>
>
>
> Reviewed-by: Christian König <christian.koenig@amd.com>
Applied. thanks!
Alex
>
>> ---
>> 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])
>
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web