From: Andi Shyti <andi.shyti@linux.intel.com>
To: Cong Liu <liucong2@kylinos.cn>
Cc: jani.nikula@linux.intel.com, airlied@gmail.com,
andi.shyti@linux.intel.com, andrzej.hajda@intel.com,
chris@chris-wilson.co.uk, daniel@ffwll.ch,
dri-devel@lists.freedesktop.org, gwan-gyeong.mun@intel.com,
intel-gfx@lists.freedesktop.org, jonathan.cavitt@intel.com,
joonas.lahtinen@linux.intel.com, linux-kernel@vger.kernel.org,
matthew.auld@intel.com, matthew.brost@intel.com,
mchehab@kernel.org, nirmoy.das@intel.com, rodrigo.vivi@intel.com,
tvrtko.ursulin@linux.intel.com
Subject: Re: [PATCH] drm/i915: Fix memory leaks in i915 selftests
Date: Thu, 13 Apr 2023 10:44:50 +0200 [thread overview]
Message-ID: <ZDfBAs/RKfAljk4o@ashyti-mobl2.lan> (raw)
In-Reply-To: <20230413075526.221068-1-liucong2@kylinos.cn>
On Thu, Apr 13, 2023 at 03:55:26PM +0800, Cong Liu wrote:
> This patch fixes memory leaks on error escapes in function fake_get_pages
>
> Fixes: c3bfba9a2225 ("drm/i915: Check for integer truncation on scatterlist creation")
> Signed-off-by: Cong Liu <liucong2@kylinos.cn>
OK, while I was proposing the adjustments suggested by Jani you
already replied to the e-mail. I will keep your version.
Anyway, next time, please, do not forget to add the r-b's, in
this case it was Andrzej's.
Andi
> ---
> drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
> index 5361ce70d3f2..154801f1c468 100644
> --- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
> @@ -69,8 +69,10 @@ static int fake_get_pages(struct drm_i915_gem_object *obj)
>
> rem = round_up(obj->base.size, BIT(31)) >> 31;
> /* restricted by sg_alloc_table */
> - if (overflows_type(rem, unsigned int))
> + if (overflows_type(rem, unsigned int)) {
> + kfree(pages);
> return -E2BIG;
> + }
>
> if (sg_alloc_table(pages, rem, GFP)) {
> kfree(pages);
> --
> 2.34.1
>
>
> No virus found
> Checked by Hillstone Network AntiVirus
next prev parent reply other threads:[~2023-04-13 8:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-13 3:13 [PATCH] drm/i915: Fix memory leaks in i915 selftests Cong Liu
2023-04-13 6:10 ` Andrzej Hajda
2023-04-13 7:15 ` Jani Nikula
2023-04-13 7:55 ` Cong Liu
2023-04-13 8:44 ` Andi Shyti [this message]
2023-04-13 9:07 ` Cong Liu
2023-04-13 8:15 ` Andi Shyti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZDfBAs/RKfAljk4o@ashyti-mobl2.lan \
--to=andi.shyti@linux.intel.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=gwan-gyeong.mun@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=jonathan.cavitt@intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liucong2@kylinos.cn \
--cc=matthew.auld@intel.com \
--cc=matthew.brost@intel.com \
--cc=mchehab@kernel.org \
--cc=nirmoy.das@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=tvrtko.ursulin@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox