From ff4eefa36dc4f7c457a545966648f2dcfda2877e Mon Sep 17 00:00:00 2001 From: Anthony Pesch Date: Wed, 29 Nov 2017 23:22:44 -0500 Subject: [PATCH] fix case where ta_get_context could return an unallocated context for address 0, as it was iterating over all available contexts, not just the allocated ones --- src/guest/pvr/ta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/guest/pvr/ta.c b/src/guest/pvr/ta.c index 9744284f..3d086e8d 100644 --- a/src/guest/pvr/ta.c +++ b/src/guest/pvr/ta.c @@ -349,7 +349,7 @@ static holly_interrupt_t list_interrupts[] = { }; static struct ta_context *ta_get_context(struct ta *ta, uint32_t addr) { - for (int i = 0; i < ARRAY_SIZE(ta->contexts); i++) { + for (int i = 0; i < ta->num_contexts; i++) { struct ta_context *ctx = &ta->contexts[i]; if (ctx->addr == addr) { return ctx;