mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 13:10:10 +01:00
intel/compiler/brw: fix potential unsigned overflow
Coverity notices that if `util_last_bit()` returns 0, and we subtract 1,
then the unsigned will overflow before being converted. We could cast to
eliminate that error, but the entire optimization function would do
nothing if tex->required_params == 0 (the way that we would get here),
so let's just not do work if we know we don't need to *and* avoid this
overflow.
CID: 1667241
Fixes: efcba73b49 ("brw: switch to new sampler payload description scheme")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38009>
This commit is contained in:
parent
fd55e874ed
commit
83c52f75d0
1 changed files with 1 additions and 1 deletions
|
|
@ -262,7 +262,7 @@ brw_opt_zero_samples(brw_shader &s)
|
|||
|
||||
foreach_block_and_inst(block, brw_inst, inst, s.cfg) {
|
||||
brw_tex_inst *tex = inst->as_tex();
|
||||
if (tex == NULL)
|
||||
if (tex == NULL || tex->required_params == 0)
|
||||
continue;
|
||||
|
||||
int last_req_param = util_last_bit(tex->required_params) - 1;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue