nv50: fix potential null deref in insn modifer optimization pass
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Fri, 19 Aug 2011 14:57:30 +0000 (16:57 +0200)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Fri, 19 Aug 2011 14:57:30 +0000 (16:57 +0200)
Bug introduced in 34980cd153050111edc545545ddff11f5b68347e.

src/gallium/drivers/nv50/nv50_pc_optimize.c

index a1590c2dc6b77c560143f2ea2170b9d2ca49e384..4271731efa7f27fe1ed9af97687cc155a306a849 100644 (file)
@@ -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);
       }
    }