pan/midgard: Fix memory corruption in constant combining
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 2 Jan 2020 18:44:40 +0000 (13:44 -0500)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 2 Jan 2020 20:20:55 +0000 (15:20 -0500)
It's a long story... but we'd try to insert constants that weren't there
and end up clobbering fields in the bundle following the constant
array...

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/panfrost/midgard/midgard_schedule.c

index d4239157ead1e0d62cefb1790ec46c17610a8afa..a78bb901b43808fa96632863999db2e8ff4a1563 100644 (file)
@@ -415,7 +415,7 @@ mir_adjust_constants(midgard_instruction *ins,
 
                         /* If the constant is new, check ourselves */
                         for (unsigned j = 0; j < i; ++j) {
-                                if (constants[j] == constants[i]) {
+                                if (constants[j] == constants[i] && (mask & (1 << j))) {
                                         ok = true;
                                         break;
                                 }