diff options
author | Paul Berry <[email protected]> | 2013-04-16 12:49:51 -0700 |
---|---|---|
committer | Paul Berry <[email protected]> | 2013-04-17 17:41:55 -0700 |
commit | 417d8917d4924652f1cd0c64dbf3677d4eddbf8c (patch) | |
tree | 06feb20a80ee06ef15c17d0981c5fd328abd99d2 /src/gallium/drivers/i915/i915_state.c | |
parent | 47bd6e46fe89e1cce61b11bcaa7b81f807011c23 (diff) |
i965/vec4: Fix hypothetical use of uninitialized data in attribute_map[].
Fixes issue identified by Klocwork analysis:
'attribute_map' array elements might be used uninitialized in this
function (vec4_visitor::lower_attributes_to_hw_regs).
The attribute_map array contains the mapping from shader input
attributes to the hardware registers they are stored in.
vec4_vs_visitor::setup_attributes() only populates elements of this
array which, according to core Mesa, are actually used by the shader.
Therefore, when vec4_visitor::lower_attributes_to_hw_regs() accesses
the array to lower a register access in the shader, it should in
principle only access elements of attribute_map that contain valid
data. However, if a bug ever caused the driver back-end to access an
input that was not flagged as used by core Mesa, then
lower_attributes_to_hw_regs() would access uninitialized memory, which
could cause illegal instructions to get generated, resulting in a
possible GPU hang.
This patch makes the situation more robust by using memset() to
pre-initialize the attribute_map array to zero, so that if such a bug
ever occurred, lower_attributes_to_hw_regs() would generate a (mostly)
harmless access to r0. In addition, it adds assertions to
lower_attributes_to_hw_regs() so that if we do have such a bug, we're
likely to discover it quickly.
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/gallium/drivers/i915/i915_state.c')
0 files changed, 0 insertions, 0 deletions