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 <alyssa.rosenzweig@collabora.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4397>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4397>
This commit is contained in:
Icecream95
2020-04-01 15:32:19 +13:00
committed by Marge Bot
parent 355abfeed5
commit 319158a814
+2 -2
View File
@@ -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 */