RDMA/uverbs: Don't overwrite NULL pointer with ZERO_SIZE_PTR
[sfrench/cifs-2.6.git] / drivers / infiniband / core / uverbs_cmd.c
index 74c5bc934822b9782d877b716c10af03fc763c61..7d70d17a853add2540382d611d6004bdac709d09 100644 (file)
@@ -2763,6 +2763,9 @@ static struct ib_uflow_resources *flow_resources_alloc(size_t num_specs)
        if (!resources)
                return NULL;
 
+       if (!num_specs)
+               goto out;
+
        resources->counters =
                kcalloc(num_specs, sizeof(*resources->counters), GFP_KERNEL);
        resources->collection =
@@ -2771,8 +2774,8 @@ static struct ib_uflow_resources *flow_resources_alloc(size_t num_specs)
        if (!resources->counters || !resources->collection)
                goto err;
 
+out:
        resources->max = num_specs;
-
        return resources;
 
 err: