panfrost: Make sure bundle.instructions[] contains valid instructions
authorBoris Brezillon <boris.brezillon@collabora.com>
Tue, 27 Aug 2019 09:12:02 +0000 (11:12 +0200)
committerBoris Brezillon <boris.brezillon@collabora.com>
Tue, 27 Aug 2019 14:50:52 +0000 (16:50 +0200)
Add an assert() in schedule_bundle() to make sure all instruction
pointers in bundle.instructions[] are valid.

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

index f80a0354fb88957c5a22477bafebd6bc5844fdd0..60ad5ebb79c803ee0ce68722a7f61435c25943b0 100644 (file)
@@ -562,6 +562,7 @@ schedule_bundle(compiler_context *ctx, midgard_block *block, midgard_instruction
 
         midgard_instruction *uins = ins;
         for (; packed_idx < bundle.instruction_count; ++packed_idx) {
+                assert(&uins->link != &block->instructions);
                 bundle.instructions[packed_idx] = uins;
                 uins = mir_next_op(uins);
         }