lkml.org 
[lkml]   [2011]   [Feb]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[09/70] drm/radeon/kms: add bounds checking to avivo pll algo
2.6.37-stable review patch.  If anyone has any objections, please let us know.

------------------
From: Alex Deucher <alexdeucher@gmail.com>

commit a4b40d5d97f5c9ad0b7f4bf2818291ca184bb433 upstream.

Prevent divider overflow.
Fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=28932

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
drivers/gpu/drm/radeon/radeon_display.c | 10 ++++++++++
1 file changed, 10 insertions(+)
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -461,6 +461,11 @@ static void avivo_get_fb_div(struct rade
tmp *= target_clock;
*fb_div = tmp / pll->reference_freq;
*frac_fb_div = tmp % pll->reference_freq;
+
+ if (*fb_div > pll->max_feedback_div)
+ *fb_div = pll->max_feedback_div;
+ else if (*fb_div < pll->min_feedback_div)
+ *fb_div = pll->min_feedback_div;
}

static u32 avivo_get_post_div(struct radeon_pll *pll,
@@ -494,6 +499,11 @@ static u32 avivo_get_post_div(struct rad
post_div--;
}

+ if (post_div > pll->max_post_div)
+ post_div = pll->max_post_div;
+ else if (post_div < pll->min_post_div)
+ post_div = pll->min_post_div;
+
return post_div;
}




\
 
 \ /
  Last update: 2011-02-22 23:39    [from the cache]
©2003-2011 Jasper Spaans