pan/mdg: Fix overflow in intra-bundle interference
authorAlyssa Rosenzweig <alyssa@collabora.com>
Wed, 23 Feb 2022 14:29:28 +0000 (09:29 -0500)
committerMarge Bot <emma+marge@anholt.net>
Wed, 23 Feb 2022 20:42:33 +0000 (20:42 +0000)
There are up to 4 instructions in the latter stage (if a branch is included),
not 3. Bump the limit to fix memory corruption.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reported-by: Icecream95 <ixn@disroot.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15147>

src/panfrost/midgard/midgard_ra.c

index af208bb..8c9ef63 100644 (file)
@@ -357,7 +357,7 @@ mir_compute_interference(
                  * avoid this situation.
                  */
                 util_dynarray_foreach(&blk->bundles, midgard_bundle, bundle) {
-                        midgard_instruction *instrs[2][3];
+                        midgard_instruction *instrs[2][4];
                         unsigned instr_count[2] = { 0, 0 };
 
                         for (unsigned i = 0; i < bundle->instruction_count; i++) {