Mesa (master): nv50: fix potential null deref in insn modifer optimization pass

Christoph Bumiller chrisbmr at kemper.freedesktop.org
Fri Aug 19 08:26:33 PDT 2011


Module: Mesa
Branch: master
Commit: 778997f9dfeffbcbeef52f7dfa93a9ebd40ff42f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=778997f9dfeffbcbeef52f7dfa93a9ebd40ff42f

Author: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
Date:   Fri Aug 19 16:57:30 2011 +0200

nv50: fix potential null deref in insn modifer optimization pass

Bug introduced in 34980cd153050111edc545545ddff11f5b68347e.

---

 src/gallium/drivers/nv50/nv50_pc_optimize.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_pc_optimize.c b/src/gallium/drivers/nv50/nv50_pc_optimize.c
index a1590c2..4271731 100644
--- a/src/gallium/drivers/nv50/nv50_pc_optimize.c
+++ b/src/gallium/drivers/nv50/nv50_pc_optimize.c
@@ -462,8 +462,10 @@ nv_pass_lower_mods(struct nv_pass *ctx, struct nv_basic_block *b)
          mi->saturate = 1;
          mi->def[0] = nvi->def[0];
          mi->def[0]->insn = mi;
-         mi->flags_def = nvi->flags_def;
-         mi->flags_def->insn = mi;
+         if (nvi->flags_def) {
+            mi->flags_def = nvi->flags_def;
+            mi->flags_def->insn = mi;
+         }
          nv_nvi_delete(nvi);
       }
    }



More information about the mesa-commit mailing list