diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2015-04-15 22:17:27 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2015-04-27 09:54:50 -0400 |
commit | b421ed15d2c3039eb724680e4de1e4b2bd196a9a (patch) | |
tree | 68721913ae096198b2fc65ffbcdcb501f900caa4 | |
parent | 59fd7e4b0b0769638b5162e56c28bbb027a118d3 (diff) |
drm/radeon: Use drm_calloc_ab for CS relocs
The number of relocs is passed in by userspace and can be large. It has
been observed to cause kcalloc failures in the wild.
Cc: stable@vger.kernel.org
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_cs.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index 4d0f96cc3da4..ab39b85e0f76 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c | |||
@@ -88,7 +88,7 @@ static int radeon_cs_parser_relocs(struct radeon_cs_parser *p) | |||
88 | p->dma_reloc_idx = 0; | 88 | p->dma_reloc_idx = 0; |
89 | /* FIXME: we assume that each relocs use 4 dwords */ | 89 | /* FIXME: we assume that each relocs use 4 dwords */ |
90 | p->nrelocs = chunk->length_dw / 4; | 90 | p->nrelocs = chunk->length_dw / 4; |
91 | p->relocs = kcalloc(p->nrelocs, sizeof(struct radeon_bo_list), GFP_KERNEL); | 91 | p->relocs = drm_calloc_large(p->nrelocs, sizeof(struct radeon_bo_list)); |
92 | if (p->relocs == NULL) { | 92 | if (p->relocs == NULL) { |
93 | return -ENOMEM; | 93 | return -ENOMEM; |
94 | } | 94 | } |
@@ -428,7 +428,7 @@ static void radeon_cs_parser_fini(struct radeon_cs_parser *parser, int error, bo | |||
428 | } | 428 | } |
429 | } | 429 | } |
430 | kfree(parser->track); | 430 | kfree(parser->track); |
431 | kfree(parser->relocs); | 431 | drm_free_large(parser->relocs); |
432 | drm_free_large(parser->vm_bos); | 432 | drm_free_large(parser->vm_bos); |
433 | for (i = 0; i < parser->nchunks; i++) | 433 | for (i = 0; i < parser->nchunks; i++) |
434 | drm_free_large(parser->chunks[i].kdata); | 434 | drm_free_large(parser->chunks[i].kdata); |