From 537f67f05362d3bb942aec9eb52a7862a0fab56b Mon Sep 17 00:00:00 2001 From: Icecream95 Date: Sun, 10 Jul 2022 20:57:24 +1200 Subject: [PATCH] panfrost: Correctly calculate prefetch suppresion varying index The xfb_base is a base index, it makes no sense to multiply that with the number of streamout targets. Use addition instead to fix a buffer overflow. Fixes: 557633b142e ("panfrost: Suppress Bifrost prefetching") Reported-by: Luc Ma Part-of: --- src/gallium/drivers/panfrost/pan_cmdstream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 0aa7a1b536f..17f4fb1e6e7 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -2667,7 +2667,7 @@ panfrost_emit_varying_descriptor(struct panfrost_batch *batch, #if PAN_ARCH >= 6 /* Suppress prefetch on Bifrost */ - memset(varyings + (xfb_base * ctx->streamout.num_targets), 0, sizeof(*varyings)); + memset(varyings + xfb_base + ctx->streamout.num_targets, 0, sizeof(*varyings)); #else /* Emit the stream out buffers. We need enough room for all the * vertices we emit across all instances */