lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Mon,  4 Jul 2016 15:18:06 +0200
From:	Arnd Bergmann <arnd@...db.de>
To:	Alex Deucher <alexander.deucher@....com>
Cc:	Arnd Bergmann <arnd@...db.de>,
	Christian König <christian.koenig@....com>,
	David Airlie <airlied@...ux.ie>, Rex Zhu <Rex.Zhu@....com>,
	Eric Huang <JinHuiEric.Huang@....com>,
	dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: [PATCH] drm/amd/powerplay: fix integer overflow warning

A late bugfix for v4.7 introduced a build-time regression, producing
a (probably harmless) warning:

powerplay/hwmgr/polaris10_hwmgr.c: In function 'polaris10_populate_clock_stretcher_data_table':
powerplay/hwmgr/polaris10_hwmgr.c:1817:4: error: this decimal constant is unsigned only in ISO C90 [-Werror]
    volt_without_cks = (uint32_t)((2753594000 + (sclk_table->entries[i].clk/100) * 136418 -(ro - 70) * 1000000) / \
    ^~~~~~~~~~~~~~~~
powerplay/hwmgr/polaris10_hwmgr.c:1822:4: error: this decimal constant is unsigned only in ISO C90 [-Werror]
    volt_without_cks = (uint32_t)((2416794800 + (sclk_table->entries[i].clk/100) * 1476925/10 -(ro - 50) * 1000000) / \
    ^~~~~~~~~~~~~~~~
powerplay/hwmgr/polaris10_hwmgr.c:1824:4: error: this decimal constant is unsigned only in ISO C90 [-Werror]
    volt_with_cks = (uint32_t)((2999656000 + sclk_table->entries[i].clk * 392803/100 - (ro - 44) * 1000000) / \

This marks the new integer literals unsigned, which makes the calculation
more sensible and avoids the warning.

Signed-off-by: Arnd Bergmann <arnd@...db.de>
Fixes: 0812a945fbb8 ("drm/amd/powerplay: Update CKS on/ CKS off voltage offset calculation")
---
 drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c
index ec2a7ada346a..5b26bbbc3e79 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c
@@ -1814,14 +1814,14 @@ static int polaris10_populate_clock_stretcher_data_table(struct pp_hwmgr *hwmgr)
 		data->smc_state_table.Sclk_CKS_masterEn0_7 |=
 				sclk_table->entries[i].cks_enable << i;
 		if (hwmgr->chip_id == CHIP_POLARIS10) {
-			volt_without_cks = (uint32_t)((2753594000 + (sclk_table->entries[i].clk/100) * 136418 -(ro - 70) * 1000000) / \
+			volt_without_cks = (uint32_t)((2753594000u + (sclk_table->entries[i].clk/100) * 136418 -(ro - 70) * 1000000) / \
 						(2424180 - (sclk_table->entries[i].clk/100) * 1132925/1000));
-			volt_with_cks = (uint32_t)((279720200 + sclk_table->entries[i].clk * 3232 - (ro - 65) * 100000000) / \
+			volt_with_cks = (uint32_t)((279720200u + sclk_table->entries[i].clk * 3232 - (ro - 65) * 100000000) / \
 					(252248000 - sclk_table->entries[i].clk/100 * 115764));
 		} else {
-			volt_without_cks = (uint32_t)((2416794800 + (sclk_table->entries[i].clk/100) * 1476925/10 -(ro - 50) * 1000000) / \
+			volt_without_cks = (uint32_t)((2416794800u + (sclk_table->entries[i].clk/100) * 1476925/10 -(ro - 50) * 1000000) / \
 						(2625416 - (sclk_table->entries[i].clk/100) * 12586807/10000));
-			volt_with_cks = (uint32_t)((2999656000 + sclk_table->entries[i].clk * 392803/100 - (ro - 44) * 1000000) / \
+			volt_with_cks = (uint32_t)((2999656000u + sclk_table->entries[i].clk * 392803/100 - (ro - 44) * 1000000) / \
 					(3422454 - sclk_table->entries[i].clk/100 * 18886376/10000));
 		}
 
-- 
2.9.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ