<div dir="ltr"><div>Applied. Thanks!</div><div><br></div><div>Alex<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 20, 2020 at 11:33 AM Christian König <<a href="mailto:christian.koenig@amd.com">christian.koenig@amd.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Am 20.05.20 um 17:31 schrieb Ruhl, Michael J:<br>
>> -----Original Message-----<br>
>> From: Dan Carpenter <<a href="mailto:dan.carpenter@oracle.com" target="_blank">dan.carpenter@oracle.com</a>><br>
>> Sent: Wednesday, May 20, 2020 11:26 AM<br>
>> To: Alex Deucher <<a href="mailto:alexander.deucher@amd.com" target="_blank">alexander.deucher@amd.com</a>>; Kevin Wang<br>
>> <<a href="mailto:kevin1.wang@amd.com" target="_blank">kevin1.wang@amd.com</a>>; Ruhl, Michael J <<a href="mailto:michael.j.ruhl@intel.com" target="_blank">michael.j.ruhl@intel.com</a>><br>
>> Cc: Christian König <<a href="mailto:christian.koenig@amd.com" target="_blank">christian.koenig@amd.com</a>>; David Airlie<br>
>> <<a href="mailto:airlied@linux.ie" target="_blank">airlied@linux.ie</a>>; Daniel Vetter <<a href="mailto:daniel@ffwll.ch" target="_blank">daniel@ffwll.ch</a>>; Evan Quan<br>
>> <<a href="mailto:evan.quan@amd.com" target="_blank">evan.quan@amd.com</a>>; Rui Huang <<a href="mailto:ray.huang@amd.com" target="_blank">ray.huang@amd.com</a>>; Kenneth Feng<br>
>> <<a href="mailto:kenneth.feng@amd.com" target="_blank">kenneth.feng@amd.com</a>>; Yintian Tao <<a href="mailto:yttao@amd.com" target="_blank">yttao@amd.com</a>>; Hawking Zhang<br>
>> <<a href="mailto:Hawking.Zhang@amd.com" target="_blank">Hawking.Zhang@amd.com</a>>; <a href="mailto:amd-gfx@lists.freedesktop.org" target="_blank">amd-gfx@lists.freedesktop.org</a>; dri-<br>
>> <a href="mailto:devel@lists.freedesktop.org" target="_blank">devel@lists.freedesktop.org</a>; <a href="mailto:linux-kernel@vger.kernel.org" target="_blank">linux-kernel@vger.kernel.org</a>; kernel-<br>
>> <a href="mailto:janitors@vger.kernel.org" target="_blank">janitors@vger.kernel.org</a><br>
>> Subject: [PATCH v3] drm/amdgpu: off by one in<br>
>> amdgpu_device_attr_create_groups() error handling<br>
>><br>
>> This loop in the error handling code should start a "i - 1" and end at<br>
>> "i == 0". Currently it starts a "i" and ends at "i == 1". The result<br>
>> is that it removes one attribute that wasn't created yet, and leaks the<br>
>> zeroeth attribute.<br>
>><br>
>> Fixes: 4e01847c38f7 ("drm/amdgpu: optimize amdgpu device attribute code")<br>
>> Signed-off-by: Dan Carpenter <<a href="mailto:dan.carpenter@oracle.com" target="_blank">dan.carpenter@oracle.com</a>><br>
>> ---<br>
>> v2: style change<br>
>> v3: Fix embarrassing typo in the subject<br>
> 😊<br>
><br>
> Acked-by: Michael J. Ruhl <<a href="mailto:michael.j.ruhl@intel.com" target="_blank">michael.j.ruhl@intel.com</a>><br>
<br>
Reviewed-by: Christian König <<a href="mailto:christian.koenig@amd.com" target="_blank">christian.koenig@amd.com</a>><br>
<br>
><br>
> m<br>
>> drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 3 +--<br>
>> 1 files changed, 1 insertions(+), 2 deletions(-)<br>
>><br>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c<br>
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c<br>
>> index b75362bf0742..e809534fabd4 100644<br>
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c<br>
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c<br>
>> @@ -1942,9 +1942,8 @@ static int amdgpu_device_attr_create_groups(struct<br>
>> amdgpu_device *adev,<br>
>> return 0;<br>
>><br>
>> failed:<br>
>> - for (; i > 0; i--) {<br>
>> + while (i--)<br>
>> amdgpu_device_attr_remove(adev, &attrs[i]);<br>
>> - }<br>
>><br>
>> return ret;<br>
>> }<br>
<br>
_______________________________________________<br>
dri-devel mailing list<br>
<a href="mailto:dri-devel@lists.freedesktop.org" target="_blank">dri-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/dri-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/dri-devel</a><br>
</blockquote></div>