Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1345rwd; Fri, 19 May 2023 14:18:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6IYHF1GcxM/jiHgAryDGmLs4cAfWlVXfAHkObSmpmB2m9oXDNT6DSjgzq+d6KVTUy1soKH X-Received: by 2002:a05:6a00:1389:b0:623:8592:75c4 with SMTP id t9-20020a056a00138900b00623859275c4mr5348479pfg.29.1684531131205; Fri, 19 May 2023 14:18:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684531131; cv=none; d=google.com; s=arc-20160816; b=fvpMepWbMLAV6DAH+SxP35H0Tj05qGgbQ7u1QN6AYIhfMFiziXPSHn7678AfY3lmYZ o2EYmFkyV1XulhiZCzwl0BSOnd5HO5/BHe6YFNWPe5Jq+sJvFH+tvwkAYheF1ndIIBXf RvnpmGssvUsZaOEoZ1ZJTMtiGm0nRLdyOlWQrKHj3GBvXQyBYOWvWF64YPiLa1FWns6G Oq0uur+Bi/lDduljVQMTx4RlZS+Pbl20vBMKsynpwx9XudQz5eD0amV5tBe/HH1awVWV F3o4AViaNZNvogO7eKWg9b+pB+Fv6Q0oQWjOcDtjmqFL7C6nRkQIOArRKyGwSwKVubvy ENUg== 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; bh=sIAlI9d8nwCLBgmh9BPWVK8jykQsVJOZguaJNGqJ494=; b=00O+zdq+D/5mi2qciFzQam4LaXdUXqlHje421HjXVT+SFZTVyPBQenf1RZBqjruYRv iNctWzTjl3HezhnOO681rfQj5FrkCACTgRqrbRXiUWtbypmarR+8uxE5DixMT9QL359x 7bIdCX8u70ThPIIrBQlvAaYIZ82fos2h9C7nYeT1hiSu5U7cO1/cPQ+lsASzm1cIMY+3 89owC21ROcAcCt+Pw6AxW/Y99d01VsX5kE3qniEKfdnuLDgDFulNxDU/5A/0m8SkUJoA zy98CMPtPGH1DgHKcA6VRcdpBWo3kRQpns8eXURiOa7r54+jfLXKDosDZkem/f3x7v7s /SAg== 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i28-20020aa796fc000000b00640d9c06df3si189831pfq.329.2023.05.19.14.18.38; Fri, 19 May 2023 14:18:51 -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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230390AbjESVKV (ORCPT + 99 others); Fri, 19 May 2023 17:10:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230406AbjESVKU (ORCPT ); Fri, 19 May 2023 17:10:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A7491711 for ; Fri, 19 May 2023 14:09:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EC92865B14 for ; Fri, 19 May 2023 21:09:48 +0000 (UTC) Received: from rdvivi-mobl4 (unknown [192.55.55.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPSA id D1892C433D2; Fri, 19 May 2023 21:09:45 +0000 (UTC) Date: Fri, 19 May 2023 17:09:43 -0400 From: Rodrigo Vivi To: Cong Liu Cc: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH v2] drm/i915: Fix memory leaks in function live_nop_switch Message-ID: References: <20230508085016.437836-1-liucong2@kylinos.cn> <20230517050204.4111874-1-liucong2@kylinos.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230517050204.4111874-1-liucong2@kylinos.cn> X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Wed, May 17, 2023 at 01:02:03PM +0800, Cong Liu wrote: > Be sure to properly free the allocated memory before exiting > the live_nop_switch function. > > Signed-off-by: Cong Liu > Suggested-by: Rodrigo Vivi pushed, thanks for the patch > --- > .../gpu/drm/i915/gem/selftests/i915_gem_context.c | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c > index a81fa6a20f5a..2fb125d0cb5e 100644 > --- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c > +++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c > @@ -66,7 +66,7 @@ static int live_nop_switch(void *arg) > ctx[n] = live_context(i915, file); > if (IS_ERR(ctx[n])) { > err = PTR_ERR(ctx[n]); > - goto out_file; > + goto out_ctx; > } > } > > @@ -82,7 +82,7 @@ static int live_nop_switch(void *arg) > this = igt_request_alloc(ctx[n], engine); > if (IS_ERR(this)) { > err = PTR_ERR(this); > - goto out_file; > + goto out_ctx; > } > if (rq) { > i915_request_await_dma_fence(this, &rq->fence); > @@ -96,7 +96,7 @@ static int live_nop_switch(void *arg) > intel_gt_set_wedged(to_gt(i915)); > i915_request_put(rq); > err = -EIO; > - goto out_file; > + goto out_ctx; > } > i915_request_put(rq); > > @@ -107,7 +107,7 @@ static int live_nop_switch(void *arg) > > err = igt_live_test_begin(&t, i915, __func__, engine->name); > if (err) > - goto out_file; > + goto out_ctx; > > end_time = jiffies + i915_selftest.timeout_jiffies; > for_each_prime_number_from(prime, 2, 8192) { > @@ -120,7 +120,7 @@ static int live_nop_switch(void *arg) > this = igt_request_alloc(ctx[n % nctx], engine); > if (IS_ERR(this)) { > err = PTR_ERR(this); > - goto out_file; > + goto out_ctx; > } > > if (rq) { /* Force submission order */ > @@ -165,7 +165,7 @@ static int live_nop_switch(void *arg) > > err = igt_live_test_end(&t); > if (err) > - goto out_file; > + goto out_ctx; > > pr_info("Switch latencies on %s: 1 = %lluns, %lu = %lluns\n", > engine->name, > @@ -173,6 +173,8 @@ static int live_nop_switch(void *arg) > prime - 1, div64_u64(ktime_to_ns(times[1]), prime - 1)); > } > > +out_ctx: > + kfree(ctx); > out_file: > fput(file); > return err; > -- > 2.34.1 > > > No virus found > Checked by Hillstone Network AntiVirus