Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2035157rwl; Thu, 13 Apr 2023 00:16:45 -0700 (PDT) X-Google-Smtp-Source: AKy350Ylh+XtGyhlSAU7lZjxuY2+nPPT/9OzWsgS+bAV2Lp1uuQMh/mWdhM4MbZzinKeFdGyyrUJ X-Received: by 2002:aa7:d74f:0:b0:504:de29:81f6 with SMTP id a15-20020aa7d74f000000b00504de2981f6mr1607639eds.11.1681370204948; Thu, 13 Apr 2023 00:16:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681370204; cv=none; d=google.com; s=arc-20160816; b=SxAsbqHwKqWfIO821yiS2YZVwDdToW20BHb8vPRKGVpu8MzGr9s3THkVjK2iiZPzuJ 1woEi2Q43RrWPKnepPe6Vjq2QIiKya8cGFzKxrAlWJkEMVxvDIFUsxIiBBFMqHwcWBaZ H6ygPRXt0uqKWydr6RXxu14lnh0IOMJGlEF5t53VDdKcmTNWa9Gm5hWSLFbnkcrd4z8L D/9ZZ8FetE3Ob46m6CQQjnmsVovbWLIz6BVMbEnuvHVviOc+4tz/mnx7GZdJrBQGRa5F 8mnoZqpeLK5YKHMp+cCtLGyAHiQI83jbnOF5vEmIxewzAjbmxw728zTlZnvHRzljevxK aIQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :organization:in-reply-to:subject:to:from:dkim-signature; bh=Bmuq/2Fx8s3PcDHEmwl+e8LqE3M3HIHBtGK46y9zBu8=; b=cVm+VIAqFtaySF16r0IZ/aMYNyVSwZ0LCiuMSV0YwzE5OMyzUy9PXYpCuMO8cUlxUD Sa+z1TrC4MBjztOs+PmWUGQxx3nyQl4fz/OIbpqdqZo+lJWejce8nj1VNVmOSDRGT1Bl RyY7b/zRIK3jZPTXD771319a1vUnMrhSZ7MRyDnpU2UJf1ittt66QlcAsDS3CWSehu7a /jhiGZlVJlwxNShpfgZB6JwOfEIrkxTk2eN4YH9uea64G5urhPzkxz5igLYFci4NdfGy u/1NUklaeqmj1boV2wjKvT94qevOnS/Slo3S6MVvBpUh8BLEUQornANfwi0CoBAlA03/ w+6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=S8rtmBcK; 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 t20-20020aa7d714000000b005002e6f0f60si1144698edq.576.2023.04.13.00.16.20; Thu, 13 Apr 2023 00:16:44 -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=S8rtmBcK; 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 S229784AbjDMHPR (ORCPT + 99 others); Thu, 13 Apr 2023 03:15:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229579AbjDMHPQ (ORCPT ); Thu, 13 Apr 2023 03:15:16 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F1945FFE for ; Thu, 13 Apr 2023 00:15:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681370115; x=1712906115; h=from:to:subject:in-reply-to:references:date:message-id: mime-version; bh=jypqQHoHc1mLtlBqinklOeRtPPtMmrLDMLbma0WWA0Q=; b=S8rtmBcKIarOqpIc9w9a6wixY0VOyVyk9COQdZzRKQNurBsL7vP2BS2E bIrLnIEcjQ5RfW+sj903/A4Dim5DXmt0ndxAJSH83m+bde/unmC5Xc2Ka h811K9zyQXnxcCoRT1ae5F8Mnma58dFDU6sR/U3xCug2CtJA2Cso3Z5f+ eOptYvCNqwyLCSTRZK9NUb7Y+0SVhgPItrVVVDD1PFqyCnoP2ULC5YYBZ R2wS+dHDkFZteTS2h94wA4GZyIrEvdztsYziua9o3RZ426L5QQ4u9XDB4 5FtTjPD6ra31cA7B6wXl1O/rMO1PSQ62ZAx8t1AldHBdOjrJkqZ2Ad4Fd A==; X-IronPort-AV: E=McAfee;i="6600,9927,10678"; a="332813202" X-IronPort-AV: E=Sophos;i="5.98,339,1673942400"; d="scan'208";a="332813202" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2023 00:15:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10678"; a="666698005" X-IronPort-AV: E=Sophos;i="5.98,339,1673942400"; d="scan'208";a="666698005" Received: from svadali-mobl1.amr.corp.intel.com (HELO localhost) ([10.252.55.23]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2023 00:15:09 -0700 From: Jani Nikula To: Andrzej Hajda , Cong Liu , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , Matthew Auld , Andi Shyti , Nirmoy Das , Matthew Brost , Jonathan Cavitt , Chris Wilson , Gwan-gyeong Mun , Mauro Carvalho Chehab , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/i915: Fix memory leaks in i915 selftests In-Reply-To: <71ba4962-14fd-887f-1d40-31089dd1cf50@intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20230413031349.9026-1-liucong2@kylinos.cn> <71ba4962-14fd-887f-1d40-31089dd1cf50@intel.com> Date: Thu, 13 Apr 2023 10:15:07 +0300 Message-ID: <874jpkckxw.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain 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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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, 13 Apr 2023, Andrzej Hajda wrote: > On 13.04.2023 05:13, Cong Liu wrote: A commit message is still needed. >> Fixes: c3bfba9a2225 ("drm/i915: Check for integer truncation on scatterlist creation") >> No blank line here. BR, Jani. >> Signed-off-by: Cong Liu >> --- > > Reviewed-by: Andrzej Hajda > > Regards > Andrzej >> 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); > -- Jani Nikula, Intel Open Source Graphics Center