Module: Mesa
Branch: master
Commit: 93c8777ace8453f4cbc879d0829e582cf151066f
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=93c8777ace8453f4cbc879d0829e582cf151066f

Author: Tony Wasserka <[email protected]>
Date:   Wed Sep  2 19:15:01 2020 +0200

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 <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6568>

---

 src/amd/common/ac_shader_util.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/amd/common/ac_shader_util.c b/src/amd/common/ac_shader_util.c
index eabde97348e..d4ccf38d803 100644
--- a/src/amd/common/ac_shader_util.c
+++ b/src/amd/common/ac_shader_util.c
@@ -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);

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to