Mesa (10.2): nv50/ir: avoid array overrun when checking for supported mods

Emil Velikov evelikov at kemper.freedesktop.org
Tue Sep 9 20:31:03 UTC 2014


Module: Mesa
Branch: 10.2
Commit: b8971318e75b4c9723cdbbd8be2fad03b80a358d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b8971318e75b4c9723cdbbd8be2fad03b80a358d

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Sat Sep  6 11:41:36 2014 -0400

nv50/ir: avoid array overrun when checking for supported mods

Reported by Coverity

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Cc: "10.2 10.3" <mesa-stable at lists.freedesktop.org>
(cherry picked from commit 874a9396c5adfdcff63139bf6ababb55c1253402)

---

 src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp |    2 +-
 src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

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 c844fa4..ee2869c 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp
@@ -448,7 +448,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 395d5b5..fdff17c 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nvc0.cpp
@@ -417,7 +417,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;
 }




More information about the mesa-commit mailing list