Commit db89c572 authored by Tony Wasserka's avatar Tony Wasserka Committed by Eric Engestrom
Browse files

amd/common: Fix various non-critical integer overflows



The result of 0xf << 28 is a signed integer and hence overflows into the sign
bit. In practice compilers did the right thing here, since the intent of the
code was unsigned arithmetic anyway.

Cc: mesa-stable
Reviewed-by: Daniel Schürmann's avatarDaniel Schürmann <daniel@schuermann.dev>
Part-of: <!6568>
(cherry picked from commit 93c8777a)
parent 3c19a2cf
......@@ -2794,7 +2794,7 @@
"description": "amd/common: Fix various non-critical integer overflows",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": null
},
......@@ -64,7 +64,7 @@ ac_get_cb_shader_mask(unsigned spi_shader_col_format)
cb_shader_mask |= 0x3 << (i * 4);
break;
case V_028714_SPI_SHADER_32_AR:
cb_shader_mask |= 0x9 << (i * 4);
cb_shader_mask |= 0x9u << (i * 4);
break;
case V_028714_SPI_SHADER_FP16_ABGR:
case V_028714_SPI_SHADER_UNORM16_ABGR:
......@@ -72,7 +72,7 @@ ac_get_cb_shader_mask(unsigned spi_shader_col_format)
case V_028714_SPI_SHADER_UINT16_ABGR:
case V_028714_SPI_SHADER_SINT16_ABGR:
case V_028714_SPI_SHADER_32_ABGR:
cb_shader_mask |= 0xf << (i * 4);
cb_shader_mask |= 0xfu << (i * 4);
break;
default:
assert(0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment