Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2125718rwl; Thu, 13 Apr 2023 01:53:21 -0700 (PDT) X-Google-Smtp-Source: AKy350bt6MKE6Fp75/Ju6fKlSv6OBU+BGAN9A8CYYvl86Bl1qf+UPOOiutdFZvpww5KKJLNBXpn1 X-Received: by 2002:a05:6a21:3283:b0:ec:885a:a056 with SMTP id yt3-20020a056a21328300b000ec885aa056mr67080pzb.33.1681376001674; Thu, 13 Apr 2023 01:53:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681376001; cv=none; d=google.com; s=arc-20160816; b=FLqvMdQOUcagq2/T8q5WODnvcjoKkArD7FpbNMp+tQm8HDzHkGJSL1l73TvitBLzgI 6bcs5iCIWGi1AmKsIn/Nc/xMToCbxsVDnl7fqnjd/hYXU3r92f4TZcvXGUgR7goMnwmC mZDjjoNxfyft3+rrECbQcdbHl6EwoEsIyq7qqqLju0vcpqFVLeMhXvpEucuFpO996XYV EScGdFYarWVW68LbJmkIDF7GTgwRiNsCyNezg4xQjApElOzQ+idKckPbdjbZFC12s1Xe +SxzWSwYKvIimAFuyVpw2aNPO4mbCABlSUv2lrQiVzsaLKnB1801ovcbEG8VyznxCzl/ B4dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=idKIXKEE1qnzHWACApNxFtT8+M86GYnFNMDM2uoEIR0=; b=U5gf38lBU46d+pXrjm7RDdp+02yeuQAxNRpM68NYbItohM/nCH4v4oP6/pZy9z/T16 fchj+nuQTKBmCY8BkhRKA1zAcdrj8l+spdyLCVTkhsp4VWMlfr44k3QgCwPrsdWA4C4b c6uViS67z6IjaOBSW5vxc1BCCk3HPMxfcYQjxRmdtP2AP/F9rq5HrxQggNZo84Yv4q7q MuHjvX5mBaT9OJo1rlml/82a81hzCWm7HsAMT86Cxmj5y3eWl3tLtNdRHI70shBA/x61 51KugrXy3+hISPtY7DoyNQ+bWZ0qzK5u57nDizwlNCPKXw36d4I10HcadsWq3j8jdoBB uRQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="m/tK7PvI"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 81-20020a621754000000b00627f0f8d49fsi1223510pfx.373.2023.04.13.01.53.10; Thu, 13 Apr 2023 01:53:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="m/tK7PvI"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229705AbjDMIpj (ORCPT + 99 others); Thu, 13 Apr 2023 04:45:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230046AbjDMIpe (ORCPT ); Thu, 13 Apr 2023 04:45:34 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08C5C65BC for ; Thu, 13 Apr 2023 01:45:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681375523; x=1712911523; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=F5PkYWMDzGQkvb18mYjjcwK7PyKR4t30hf5aKzG1AgM=; b=m/tK7PvIbBnkUAWEpeKVFi0mHzdfaee411x7+lv2zhkWQHl0ZLuqYopY vIMBBC+CjLgsQk52xuALUuzUDy9vxKYLu8nJsE/jGw0nvXPDJ1L/LC7GC M+4M4S69PmEwj53j+8Q6PT5rlB8KQzSrhyw+VFFtjtJvr5FPrshIXewNH pMuzw4MMjW+TS/Ucq7DkhitlI6swbMhMWzyOdVvx4W9CIUci0n6e9JGZq XK56qn1wpjSUsP+OunU6qmzGkIcMoFLxj+IbFnZSHa/U7V8sMqy79aCzd PIsyaJFPSZ04cN+Ao+m8Zgu/xD2AKglfsdSklFHC26E3Q0TyqrRcXFoCr g==; X-IronPort-AV: E=McAfee;i="6600,9927,10678"; a="346807664" X-IronPort-AV: E=Sophos;i="5.98,341,1673942400"; d="scan'208";a="346807664" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2023 01:45:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10678"; a="666725820" X-IronPort-AV: E=Sophos;i="5.98,341,1673942400"; d="scan'208";a="666725820" Received: from zbiro-mobl.ger.corp.intel.com (HELO intel.com) ([10.251.212.144]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2023 01:45:16 -0700 Date: Thu, 13 Apr 2023 10:44:50 +0200 From: Andi Shyti To: Cong Liu 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 Message-ID: References: <874jpkckxw.fsf@intel.com> <20230413075526.221068-1-liucong2@kylinos.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230413075526.221068-1-liucong2@kylinos.cn> X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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