Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1401314 > unrolled thread

[PATCH] gpu:drm:radeon:fix array out fo bouds

Started byHeloise NH <os@iscas.ac.cn>
First post2016-05-16 07:10 +0200
Last post2016-05-16 16:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] gpu:drm:radeon:fix array out fo bouds Heloise NH <os@iscas.ac.cn> - 2016-05-16 07:10 +0200
    Re: [PATCH] gpu:drm:radeon:fix array out fo bouds Alex Deucher <alexdeucher@gmail.com> - 2016-05-16 16:40 +0200

#1401314 — [PATCH] gpu:drm:radeon:fix array out fo bouds

FromHeloise NH <os@iscas.ac.cn>
Date2016-05-16 07:10 +0200
Subject[PATCH] gpu:drm:radeon:fix array out fo bouds
Message-ID<rziWZ-2Hq-1@gated-at.bofh.it>
From: tom will <os@iscas.ac.cn>

When the initial value of i is greater than zero,
it may cause endless loop, resulting in array out
of bouds, fix it.

Signed-off-by: tom will <os@iscas.ac.cn>
---
 drivers/gpu/drm/radeon/kv_dpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c
index d024074..a7e9786 100644
--- a/drivers/gpu/drm/radeon/kv_dpm.c
+++ b/drivers/gpu/drm/radeon/kv_dpm.c
@@ -2164,7 +2164,7 @@ static void kv_apply_state_adjust_rules(struct radeon_device *rdev,
 	if (pi->caps_stable_p_state) {
 		stable_p_state_sclk = (max_limits->sclk * 75) / 100;
 
-		for (i = table->count - 1; i >= 0; i++) {
+		for (i = table->count - 1; i >= 0; i--) {
 			if (stable_p_state_sclk >= table->entries[i].clk) {
 				stable_p_state_sclk = table->entries[i].clk;
 				break;
-- 
2.1.0

[toc] | [next] | [standalone]


#1401543

FromAlex Deucher <alexdeucher@gmail.com>
Date2016-05-16 16:40 +0200
Message-ID<rzrQB-8bT-7@gated-at.bofh.it>
In reply to#1401314
On Mon, May 16, 2016 at 12:58 AM, Heloise NH <os@iscas.ac.cn> wrote:
> From: tom will <os@iscas.ac.cn>
>
> When the initial value of i is greater than zero,
> it may cause endless loop, resulting in array out
> of bouds, fix it.
>
> Signed-off-by: tom will <os@iscas.ac.cn>

Applied to both radeon and amgpu.

Thanks!

Alex

> ---
>  drivers/gpu/drm/radeon/kv_dpm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c
> index d024074..a7e9786 100644
> --- a/drivers/gpu/drm/radeon/kv_dpm.c
> +++ b/drivers/gpu/drm/radeon/kv_dpm.c
> @@ -2164,7 +2164,7 @@ static void kv_apply_state_adjust_rules(struct radeon_device *rdev,
>         if (pi->caps_stable_p_state) {
>                 stable_p_state_sclk = (max_limits->sclk * 75) / 100;
>
> -               for (i = table->count - 1; i >= 0; i++) {
> +               for (i = table->count - 1; i >= 0; i--) {
>                         if (stable_p_state_sclk >= table->entries[i].clk) {
>                                 stable_p_state_sclk = table->entries[i].clk;
>                                 break;
> --
> 2.1.0
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web