From: Ilia Mirkin Date: Sat, 6 Sep 2014 15:41:36 +0000 (-0400) Subject: nv50/ir: avoid array overrun when checking for supported mods X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=874a9396c5adfdcff63139bf6ababb55c1253402;p=mesa.git nv50/ir: avoid array overrun when checking for supported mods Reported by Coverity Signed-off-by: Ilia Mirkin Cc: "10.2 10.3" --- diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp index b0d617affa7..ebcb0ac2a67 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp @@ -449,7 +449,7 @@ TargetNV50::isModSupported(const Instruction *insn, int s, Modifier mod) const return false; } } - if (s > 3) + if (s >= 3) return false; return (mod & Modifier(opInfo[insn->op].srcMods[s])) == mod; } diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp index 963b6e47ddf..817ceb862d7 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp @@ -423,7 +423,7 @@ TargetNVC0::isModSupported(const Instruction *insn, int s, Modifier mod) const return false; } } - if (s > 3) + if (s >= 3) return false; return (mod & Modifier(opInfo[insn->op].srcMods[s])) == mod; }