From: Alyssa Rosenzweig Date: Sun, 27 Sep 2020 23:45:50 +0000 (-0400) Subject: pan/bi: Fix memory corruption in scheduler X-Git-Tag: upstream/21.0.0~4417 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=405544eae56e06845e026b73527016db1638ff45;p=platform%2Fupstream%2Fmesa.git pan/bi: Fix memory corruption in scheduler If empty the last will be bogus, I think. Missing Rust hard right around now. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Boris Brezillon Part-of: --- diff --git a/src/panfrost/bifrost/bi_schedule.c b/src/panfrost/bifrost/bi_schedule.c index 2ff1d50..a336e5e 100644 --- a/src/panfrost/bifrost/bi_schedule.c +++ b/src/panfrost/bifrost/bi_schedule.c @@ -241,10 +241,11 @@ bi_schedule(bi_context *ctx) /* Back-to-back bit affects only the last clause of a block, * the rest are implicitly true */ - bi_clause *last_clause = list_last_entry(&bblock->clauses, bi_clause, link); - if (last_clause) + if (!list_is_empty(&bblock->clauses)) { + bi_clause *last_clause = list_last_entry(&bblock->clauses, bi_clause, link); last_clause->back_to_back = bi_back_to_back(bblock); + } bblock->scheduled = true; }