Skip to contentSkip to conversation

drm/radeon: Use drm_calloc_ab for CS relocs

PATCH In review Michel Dänzer 3 participants 4 messages Apr 16, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/radeon: Use drm_calloc_ab for CS relocs

From: Michel Dänzer <[email protected]>

The number of relocs is passed in by userspace and can be large. It has been observed to cause kmalloc failures in the wild.

---
 drivers/gpu/drm/radeon/radeon_cs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_cs.c +2 -2
index 4d0f96c..ab39b85 100644
@@ -88,7 +88,7 @@ static int radeon_cs_parser_relocs(struct radeon_cs_parser *p)
 	p->dma_reloc_idx = 0;
 	/* FIXME: we assume that each relocs use 4 dwords */
 	p->nrelocs = chunk->length_dw / 4;
-	p->relocs = kcalloc(p->nrelocs, sizeof(struct radeon_bo_list), GFP_KERNEL);
+	p->relocs = drm_calloc_large(p->nrelocs, sizeof(struct radeon_bo_list));
 	if (p->relocs == NULL) {
 		return -ENOMEM;
 	}
@@ -428,7 +428,7 @@ static void radeon_cs_parser_fini(struct radeon_cs_parser *parser, int error, bo
 		}
 	}
 	kfree(parser->track);
-	kfree(parser->relocs);
+	drm_free_large(parser->relocs);
 	drm_free_large(parser->vm_bos);
 	for (i = 0; i < parser->nchunks; i++)
 		drm_free_large(parser->chunks[i].kdata);
Signature · 6 lines
2.1.4

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 4 lines · Michel Dänzer

From: Michel Dänzer <[email protected]>

The number of relocs is passed in by userspace and can be large. It has been observed to cause kmalloc failures in the wild.

That should of course say 'kcalloc failures'.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
Quoted 6 lines · Michel Dänzer
Quoted 4 lines · Michel Dänzer

From: Michel Dänzer <[email protected]>

The number of relocs is passed in by userspace and can be large. It has been observed to cause kmalloc failures in the wild.

That should of course say 'kcalloc failures'.

Yeah, with that fixed in the commit message the patch is Reviewed-by: Christian König <[email protected]>

Regards,
Christian.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
Quoted 6 lines · Christian König
Quoted 5 lines · Michel Dänzer
Quoted 3 lines · Michel Dänzer

From: Michel Dänzer <[email protected]>

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The number of relocs is passed in by userspace and can be large. It has been observed to cause kmalloc failures in the wild.

That should of course say 'kcalloc failures'.

Yeah, with that fixed in the commit message the patch is Reviewed-by:
Christian König <[email protected]>

Applied with the commit message fixed.

Alex

Quoted 8 lines

Regards,
Christian.

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel