Module: Mesa Branch: master Commit: 53c48feae086bbf5b17798fc1cd98ab14a17c7a8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=53c48feae086bbf5b17798fc1cd98ab14a17c7a8
Author: Rob Clark <robcl...@freedesktop.org> Date: Wed May 18 10:17:02 2016 -0400 nir: coverity sign-extension fix Not 100% sure, but I think being an unsigned literal will help: CID 1358505 (#1 of 1): Unintended sign extension (SIGN_EXTENSION)sign_extension: Suspicious implicit sign extension: load1->def.num_components with type unsigned char (8 bits, unsigned) is promoted in load1->def.num_components * (load1->def.bit_size / 8) to type int (32 bits, signed), then sign-extended to type unsigned long (64 bits, unsigned). If load1->def.num_components * (load1->def.bit_size / 8) is greater than 0x7FFFFFFF, the upper bits of the result will all be 1. Signed-off-by: Rob Clark <robcl...@freedesktop.org> Reviewed-by: Matt Turner <matts...@gmail.com> --- src/compiler/nir/nir_instr_set.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_instr_set.c b/src/compiler/nir/nir_instr_set.c index fe312a0..f93ec9d 100644 --- a/src/compiler/nir/nir_instr_set.c +++ b/src/compiler/nir/nir_instr_set.c @@ -334,7 +334,7 @@ nir_instrs_equal(const nir_instr *instr1, const nir_instr *instr2) return false; return memcmp(load1->value.f32, load2->value.f32, - load1->def.num_components * (load1->def.bit_size / 8)) == 0; + load1->def.num_components * (load1->def.bit_size / 8u)) == 0; } case nir_instr_type_phi: { nir_phi_instr *phi1 = nir_instr_as_phi(instr1); _______________________________________________ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit