video: tegra: nvmap: Remove WARN_ON and exit gracefully

Remove WARN_ON macro invocation and exit gracefully from the nvmap_query_heap_params function when the heap_mask parameter is not a power of two. This is because if two or more bits are set in heap_mask, then it's an invalid parameter because NvMap can allocate buffer from only one heap at a time.

Bug 4479038

Change-Id: I6cfca911115f7f29e2c4e46816a89fa1869adae4
Signed-off-by: Yash Bhatt <ybhatt@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3154939
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Yash Bhatt
2024-06-11 06:40:07 +00:00
committed by mobile promotions
parent 42585a86f3
commit 601fdeaed2

View File

@@ -1263,7 +1263,11 @@ static int nvmap_query_heap_params(void __user *arg, bool is_numa_aware)
}
type = op.heap_mask;
WARN_ON(type & (type - 1));
if (type & (type - 1)) {
ret = -EINVAL;
goto exit;
}
if (is_numa_aware)
numa_id = op.numa_id;