Re: [PATCH v3] drm/amdgpu: off by one in amdgpu_device_attr_create_groups() error handling
Applied. Thanks! Alex On Wed, May 20, 2020 at 11:33 AM Christian König wrote: > Am 20.05.20 um 17:31 schrieb Ruhl, Michael J: > >> -Original Message- > >> From: Dan Carpenter > >> Sent: Wednesday, May 20, 2020 11:26 AM > >> To: Alex Deucher ; Kevin Wang > >> ; Ruhl, Michael J > >> Cc: Christian König ; David Airlie > >> ; Daniel Vetter ; Evan Quan > >> ; Rui Huang ; Kenneth Feng > >> ; Yintian Tao ; Hawking Zhang > >> ; amd-...@lists.freedesktop.org; dri- > >> de...@lists.freedesktop.org; linux-ker...@vger.kernel.org; kernel- > >> janit...@vger.kernel.org > >> Subject: [PATCH v3] drm/amdgpu: off by one 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 > >> v3: Fix embarrassing typo in the subject > > > > > > Acked-by: Michael J. Ruhl > > Reviewed-by: Christian König > > > > > m > >> 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, [i]); > >> -} > >> > >> return ret; > >> } > > ___ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3] drm/amdgpu: off by one in amdgpu_device_attr_create_groups() error handling
Am 20.05.20 um 17:31 schrieb Ruhl, Michael J: -Original Message- From: Dan Carpenter Sent: Wednesday, May 20, 2020 11:26 AM To: Alex Deucher ; Kevin Wang ; Ruhl, Michael J Cc: Christian König ; David Airlie ; Daniel Vetter ; Evan Quan ; Rui Huang ; Kenneth Feng ; Yintian Tao ; Hawking Zhang ; amd-...@lists.freedesktop.org; dri- de...@lists.freedesktop.org; linux-ker...@vger.kernel.org; kernel- janit...@vger.kernel.org Subject: [PATCH v3] drm/amdgpu: off by one 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 v3: Fix embarrassing typo in the subject Acked-by: Michael J. Ruhl Reviewed-by: Christian König m 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, [i]); - } return ret; } ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
RE: [PATCH v3] drm/amdgpu: off by one in amdgpu_device_attr_create_groups() error handling
>-Original Message- >From: Dan Carpenter >Sent: Wednesday, May 20, 2020 11:26 AM >To: Alex Deucher ; Kevin Wang >; Ruhl, Michael J >Cc: Christian König ; David Airlie >; Daniel Vetter ; Evan Quan >; Rui Huang ; Kenneth Feng >; Yintian Tao ; Hawking Zhang >; amd-...@lists.freedesktop.org; dri- >de...@lists.freedesktop.org; linux-ker...@vger.kernel.org; kernel- >janit...@vger.kernel.org >Subject: [PATCH v3] drm/amdgpu: off by one 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 >v3: Fix embarrassing typo in the subject Acked-by: Michael J. Ruhl m > 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, [i]); >- } > > return ret; > } ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel