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 <liucong2@kylinos.cn> Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230414224109.1051922-1-andi.shyti@linux.intel.com (cherry picked from commit 8bfbdad) Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
1 parent 631420b commit 803033c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

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)