mirror of
https://github.com/torvalds/linux.git
synced 2026-04-24 09:35:52 -04:00
drm/amd/display: Explicitly extend unsigned 16 bit to 64 bit
Coverity reports sign extention defects as below: Suspicious implicit sign extension: mode->htotal with type u16 ... to int (32 bits, signed), then sign-extended to type unsigned long (64 bits, unsigned). If mode->htotal * mode->vtotal is greater than 0x7FFFFFFF, the upper bits of the result will all be 1. Cast it to unsigned long to avoid possible overflow. This fixes 4 SIGN_EXTENSION issues reported by Coverity. Reviewed-by: Harry Wentland <harry.wentland@amd.com> Acked-by: Hamza Mahfooz <hamza.mahfooz@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
@@ -977,8 +977,8 @@ static void amdgpu_dm_fbc_init(struct drm_connector *connector)
|
||||
|
||||
|
||||
list_for_each_entry(mode, &connector->modes, head) {
|
||||
if (max_size < mode->htotal * mode->vtotal)
|
||||
max_size = mode->htotal * mode->vtotal;
|
||||
if (max_size < (unsigned long) mode->htotal * mode->vtotal)
|
||||
max_size = (unsigned long) mode->htotal * mode->vtotal;
|
||||
}
|
||||
|
||||
if (max_size) {
|
||||
|
||||
Reference in New Issue
Block a user