Skip to content

Commit 803033c

Browse files
Cong Liujlahtine-intel
authored andcommitted
drm/i915: Fix memory leaks in i915 selftests
This patch fixes memory leaks on error escapes in function fake_get_pages Fixes: c3bfba9 ("drm/i915: Check for integer truncation on scatterlist creation") Signed-off-by: Cong Liu <[email protected]> Reviewed-by: Andrzej Hajda <[email protected]> Reviewed-by: Andi Shyti <[email protected]> Signed-off-by: Andi Shyti <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 8bfbdad) Signed-off-by: Joonas Lahtinen <[email protected]>
1 parent 631420b commit 803033c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/gpu/drm/i915/selftests/i915_gem_gtt.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,10 @@ static int fake_get_pages(struct drm_i915_gem_object *obj)
6969

7070
rem = round_up(obj->base.size, BIT(31)) >> 31;
7171
/* restricted by sg_alloc_table */
72-
if (overflows_type(rem, unsigned int))
72+
if (overflows_type(rem, unsigned int)) {
73+
kfree(pages);
7374
return -E2BIG;
75+
}
7476

7577
if (sg_alloc_table(pages, rem, GFP)) {
7678
kfree(pages);

0 commit comments

Comments
 (0)