nvc0: handle nr being 0 in nvc0_set_global_bindings
authorKarol Herbst <kherbst@redhat.com>
Wed, 20 May 2020 15:40:28 +0000 (17:40 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 19 Aug 2020 18:11:42 +0000 (18:11 +0000)
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Pierre Moreau <dev@pmoreau.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6367>

src/gallium/drivers/nouveau/nvc0/nvc0_state.c

index 5cb07609daed43f7966710e25ec283edcaf433f6..076fe1c6decc15ad307bac61f92bdf9d85067b32 100644 (file)
@@ -1379,6 +1379,9 @@ nvc0_set_global_bindings(struct pipe_context *pipe,
    unsigned i;
    const unsigned end = start + nr;
 
+   if (!nr)
+      return;
+
    if (nvc0->global_residents.size <= (end * sizeof(struct pipe_resource *))) {
       const unsigned old_size = nvc0->global_residents.size;
       if (util_dynarray_resize(&nvc0->global_residents, struct pipe_resource *, end)) {