From: Icecream95 Date: Wed, 1 Apr 2020 02:32:19 +0000 (+1300) Subject: pan/midgard: Fix a divide by zero in emit_alu_bundle X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=319158a814ae0833573d5e4ff7150504aebae59b;p=mesa.git pan/midgard: Fix a divide by zero in emit_alu_bundle util_dynarray_grow_bytes divides by eltsize, but it's possible for bundle->padding to be zero. I changed the other call to util_dynarray_grow_bytes for consistency. Reviewed-by: Alyssa Rosenzweig Tested-by: Marge Bot Part-of: --- diff --git a/src/panfrost/midgard/midgard_emit.c b/src/panfrost/midgard/midgard_emit.c index 2b18aac3553..0c5d60efa4a 100644 --- a/src/panfrost/midgard/midgard_emit.c +++ b/src/panfrost/midgard/midgard_emit.c @@ -372,11 +372,11 @@ emit_alu_bundle(compiler_context *ctx, source = &scalarized; } - memcpy(util_dynarray_grow_bytes(emission, 1, size), source, size); + memcpy(util_dynarray_grow_bytes(emission, size, 1), source, size); } /* Emit padding (all zero) */ - memset(util_dynarray_grow_bytes(emission, 1, bundle->padding), 0, bundle->padding); + memset(util_dynarray_grow_bytes(emission, bundle->padding, 1), 0, bundle->padding); /* Tack on constants */