提交 a4b40d5d 编写于 作者: A Alex Deucher 提交者: Dave Airlie

drm/radeon/kms: add bounds checking to avivo pll algo

Prevent divider overflow.
Fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=28932Signed-off-by: NAlex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: NDave Airlie <airlied@redhat.com>
上级 bd91572e
...@@ -793,6 +793,11 @@ static void avivo_get_fb_div(struct radeon_pll *pll, ...@@ -793,6 +793,11 @@ static void avivo_get_fb_div(struct radeon_pll *pll,
tmp *= target_clock; tmp *= target_clock;
*fb_div = tmp / pll->reference_freq; *fb_div = tmp / pll->reference_freq;
*frac_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, static u32 avivo_get_post_div(struct radeon_pll *pll,
...@@ -826,6 +831,11 @@ static u32 avivo_get_post_div(struct radeon_pll *pll, ...@@ -826,6 +831,11 @@ static u32 avivo_get_post_div(struct radeon_pll *pll,
post_div--; 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; return post_div;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册