freedreno/rnndec: Avoid making 0-length variable length arrays.

ubsan hates it.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6360>
This commit is contained in:
Emma Anholt 2021-09-23 13:56:04 -07:00 committed by Marge Bot
parent bd8bfe43fa
commit ba9e994034

View file

@ -418,7 +418,7 @@ static struct rnndecaddrinfo *trymatch (struct rnndeccontext *ctx, struct rnndel
offset = addr - (elems[i]->offset + elems[i]->stride * idx);
int extraidx = (elems[i]->length != 1);
int nindnum = (elems[i]->name ? 0 : indicesnum + extraidx);
uint64_t nind[nindnum];
uint64_t nind[MAX2(nindnum, 1)];
if (!elems[i]->name) {
for (j = 0; j < indicesnum; j++)
nind[j] = indices[j];