Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp643706ybk; Wed, 20 May 2020 08:25:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwj3No1ZsOJy9YBoNkVqxAwcQyl877o2jwiRB808kJFEh0Nkf1hqFlb6lDQq7//prn2Ou9+ X-Received: by 2002:a17:906:6a43:: with SMTP id n3mr3942003ejs.453.1589988338526; Wed, 20 May 2020 08:25:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589988338; cv=none; d=google.com; s=arc-20160816; b=hS+TqUd4/URn4Q3riWjqk1K9d8fH3HPLO6CvqL+S4prV4VdlrfsUBN+No1ncGk/67v 1Xqe/pvobHrFKrGeiqcOk45U8WbqbRVKPttZHu03Vs6Gr5KDFIkH/1R95y8eYetD4jEs Zsda/v1xLWy/vMVcSPwfCiegE10IafkKtHOHlLQkpVxEVOevQHu+tj6loGmBPr7/sH9n eRK3pfm9dT5xsAEjeRUOc9XdmWs58KUoPGjLTJjPSNDdO/uq2PWkmXYi5AWp/rBV3+ov iae0Dr/KInO+KTvkNQLDCOZreehOXeuh9YUvu2kFeTqtYsoiYzJc5zRYZfFmlWC9+rro LONg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-reaction:dlp-version:dlp-product:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=PKIjbh9FkKAmqC29Ttay2MmR2OcjgWt7UN20ZLyew2k=; b=vx/K3IcAZQxMVUkrAtr3R/mTs2MNlOPKHEvXZReO4VBoq8MbH1aWMf74Tg62GxSLtZ iJX/EOyxZVVkkZUqczfp127k3mHpopn9LZHcE+Qv48j60F2VxCarQ31fUjCB+ge+Vlr+ gZ9CQ5jqJe68DhCT4uQhzTteftFi5lePwZMNIXVivYwRSPKr7hZaZ3tckw8pSuuz9JsO lsHdcBrN3rt/uDvh3t6Gfx8YxNiLtTuZci77Q1S6wPPBkAz8cKQz/0lJrmVjrVCyp2TL i2N28kN31tL2zWewwY4J8twjASQQ/rZl1nOPhTdJ7WojP+RIKPmw0Gk2v0lYzgCYTx/Z WEGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z1si1784369edm.572.2020.05.20.08.25.14; Wed, 20 May 2020 08:25:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726917AbgETPXz convert rfc822-to-8bit (ORCPT + 99 others); Wed, 20 May 2020 11:23:55 -0400 Received: from mga09.intel.com ([134.134.136.24]:32705 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726729AbgETPXy (ORCPT ); Wed, 20 May 2020 11:23:54 -0400 IronPort-SDR: WR8+yPwwH0i1D9vtMloCx6u1fLFkLvn+oalhwokfYdK68XRQPpjAW/b7JGj2PYOXXE+zHk7iWY ebPxIYhqm9VA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2020 08:23:53 -0700 IronPort-SDR: AkeQM6LZ3P7X6Oi8bFUdxbhbbvsvujPavT2OPZY5Aa8oNm0QW2ltDRhi5803B9ircrW61/80KB 0byOG3sFXlVg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,414,1583222400"; d="scan'208";a="253700519" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga007.fm.intel.com with ESMTP; 20 May 2020 08:23:53 -0700 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 20 May 2020 08:23:53 -0700 Received: from fmsmsx108.amr.corp.intel.com ([169.254.9.97]) by fmsmsx115.amr.corp.intel.com ([169.254.4.85]) with mapi id 14.03.0439.000; Wed, 20 May 2020 08:23:53 -0700 From: "Ruhl, Michael J" To: Dan Carpenter , Alex Deucher , Kevin Wang CC: David Airlie , "kernel-janitors@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "amd-gfx@lists.freedesktop.org" , Hawking Zhang , "Rui Huang" , "dri-devel@lists.freedesktop.org" , Evan Quan , "Kenneth Feng" , =?iso-8859-1?Q?Christian_K=F6nig?= , Yintian Tao Subject: RE: [PATCH v2] drm/amdgpu: off by on in amdgpu_device_attr_create_groups() error handling Thread-Topic: [PATCH v2] drm/amdgpu: off by on in amdgpu_device_attr_create_groups() error handling Thread-Index: AQHWLqgW9uvuDNiQMEi3BV2xZkJF36ixF+EA Date: Wed, 20 May 2020 15:23:52 +0000 Message-ID: <14063C7AD467DE4B82DEDB5C278E8663010E2302FA@FMSMSX108.amr.corp.intel.com> References: <20200520125209.GP3041@kadam> <20200520130812.GA177222@mwanda> In-Reply-To: <20200520130812.GA177222@mwanda> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.1.200.106] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "off by on" or "off by one" ? M >-----Original Message----- >From: dri-devel On Behalf Of Dan >Carpenter >Sent: Wednesday, May 20, 2020 9:08 AM >To: Alex Deucher ; Kevin Wang > >Cc: David Airlie ; kernel-janitors@vger.kernel.org; linux- >kernel@vger.kernel.org; amd-gfx@lists.freedesktop.org; Hawking Zhang >; Rui Huang ; dri- >devel@lists.freedesktop.org; Evan Quan ; Kenneth >Feng ; Christian K?nig >; Yintian Tao >Subject: [PATCH v2] drm/amdgpu: off by on in >amdgpu_device_attr_create_groups() error handling > >This loop in the error handling code should start a "i - 1" and end at >"i == 0". Currently it starts a "i" and ends at "i == 1". The result >is that it removes one attribute that wasn't created yet, and leaks the >zeroeth attribute. > >Fixes: 4e01847c38f7 ("drm/amdgpu: optimize amdgpu device attribute code") >Signed-off-by: Dan Carpenter >--- >v2: style change > > drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 3 +-- > 1 files changed, 1 insertions(+), 2 deletions(-) > >diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c >b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c >index b75362bf0742..e809534fabd4 100644 >--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c >+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c >@@ -1942,9 +1942,8 @@ static int amdgpu_device_attr_create_groups(struct >amdgpu_device *adev, > return 0; > > failed: >- for (; i > 0; i--) { >+ while (i--) > amdgpu_device_attr_remove(adev, &attrs[i]); >- } > > return ret; > } >_______________________________________________ >dri-devel mailing list >dri-devel@lists.freedesktop.org >https://lists.freedesktop.org/mailman/listinfo/dri-devel