Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1836302rwl; Wed, 12 Apr 2023 20:16:09 -0700 (PDT) X-Google-Smtp-Source: AKy350Yk5lXdZwcE9Klq6uFQZiqnKukkHzrgGS+pXoayMes+exeuHF1ERhZy1wsnom36YGLhhfVC X-Received: by 2002:a05:6a20:ba87:b0:ec:26cf:fb86 with SMTP id fb7-20020a056a20ba8700b000ec26cffb86mr633976pzb.21.1681355768765; Wed, 12 Apr 2023 20:16:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681355768; cv=none; d=google.com; s=arc-20160816; b=T8JnS1kKm75lMe6oOMaPsaKlRG33bF28kAKUPnZ/u3rRGwIr14eueHOBoZxloXG3Tb Rv0ERdWXcMWE+CdSzdt55K4Njt3vS/25XZD0HN8Y3QRQ/Ibn9Sw7FMGVUhPWoWN7bNBF jrIK4TJygjlb773KwT8UgDd/z3H+d3B0dT5c5GduUxu7sM6mGWGD++oILXEpe5F2VaTf hb9Zr+sZCr7kWjbVAtq3H0opq/IF8ziy+oN6tNBqUWdyHDGS52r73cME2XiEruiY1wiw M99cANkAcEZ7/CmrAcyCj/Df15IQzgHrX7rd4yxCTQKk6gvP5M9eayiWbTiqNv7oPKLa VJPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=GfcCQUDVkXVYrHXBPz2lrOInNuloWlnckK68LFDJW9g=; b=t6viZ2+Z2RKOxKMpOzy9L5X4+QMDzqJqabOz40SBeOfEqVO3uYWqVzQjpTyo6CLARk U1/ZBnOkCsENcdjXBwVofrAC6Q/w+vKd4pj+NoUerkg4rO9VZi8pO/Z/bxm3yJTZ2eTx 3rbhI7R2+Tw+GEs0axUVnAEBeB2zP3swN7zWLOcl5/Djxi8PuvcFiqTteLPQw1ovVNif +lFo4osa1rom6CtBPk14pO3ILbKA35WumSKoaVWFpnpiV7yW1fQFPgSdwozFqXPsM3Ke FmtI6DW2QIiRjyA/BshSHZvAt63yT4/iKkJNIl7eRyjHwwlJliPGIyW9akJptbIJpbeH ve4g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i68-20020a625447000000b0063b2399c58asi513847pfb.195.2023.04.12.20.15.57; Wed, 12 Apr 2023 20:16:08 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229516AbjDMDOJ (ORCPT + 99 others); Wed, 12 Apr 2023 23:14:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbjDMDOH (ORCPT ); Wed, 12 Apr 2023 23:14:07 -0400 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 475B24EDD for ; Wed, 12 Apr 2023 20:14:06 -0700 (PDT) X-UUID: 2af2d65a6c6840df86ab547bf360109b-20230413 X-CID-UNFAMILIAR: 1 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:c30541db-2ea1-4af6-9267-42766adcc549,IP:5,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:8,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:8 X-CID-INFO: VERSION:1.1.22,REQID:c30541db-2ea1-4af6-9267-42766adcc549,IP:5,URL :0,TC:0,Content:-5,EDM:0,RT:0,SF:8,FILE:0,BULK:0,RULE:Release_HamU,ACTION: release,TS:8 X-CID-META: VersionHash:120426c,CLOUDID:1255e483-cd9c-45f5-8134-710979e3df0e,B ulkID:230413111352DVZVW4B9,BulkQuantity:0,Recheck:0,SF:19|44|38|24|16|102, TC:nil,Content:0,EDM:-3,IP:-2,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-UUID: 2af2d65a6c6840df86ab547bf360109b-20230413 X-User: liucong2@kylinos.cn Received: from localhost.localdomain [(116.128.244.169)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 30789537; Thu, 13 Apr 2023 11:13:51 +0800 From: Cong Liu To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , Matthew Auld , Andi Shyti , Nirmoy Das , Andrzej Hajda , 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 Cc: Cong Liu Subject: [PATCH] drm/i915: Fix memory leaks in i915 selftests Date: Thu, 13 Apr 2023 11:13:49 +0800 Message-Id: <20230413031349.9026-1-liucong2@kylinos.cn> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY 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 Fixes: c3bfba9a2225 ("drm/i915: Check for integer truncation on scatterlist creation") Signed-off-by: Cong Liu --- 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