video: tegra: nvmap: Correct the data type

When granule_size of type u32 and size is more than 4GB (i.e. value
having more than 32 bits), then ALIGN_GRANULE_SIZE would return
incorrect value due to ~(GRANULE_SIZE - 1),  as this would be in 32
bits. Hence change the granule size's data type to size_t, so that the
above value is not restricted to 32 bits.

Bug 4650102

Change-Id: If44f2663b6a4735c193d3a80b233b53d70772335
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3149162
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Tested-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Ketan Patil
2024-06-01 01:32:40 -07:00
committed by mobile promotions
parent e670902c1f
commit dc9b7b572c
2 changed files with 2 additions and 2 deletions

View File

@@ -498,7 +498,7 @@ void nvmap_dma_free_attrs(struct device *dev, size_t size, void *cpu_addr,
struct dma_coherent_mem_replica *mem;
bool is_gpu = false;
const char *device_name;
u32 granule_size = 0;
size_t granule_size = 0;
if (!dev || !dev->dma_mem)
return;

View File

@@ -223,7 +223,7 @@ int nvmap_ioctl_alloc(struct file *filp, void __user *arg)
* In case of Gpu carveout, the handle size needs to be aligned to granule.
*/
if (op.heap_mask & NVMAP_HEAP_CARVEOUT_GPU) {
u32 granule_size = 0;
size_t granule_size = 0;
for (i = 0; i < nvmap_dev->nr_carveouts; i++)
if (nvmap_dev->heaps[i].heap_bit & NVMAP_HEAP_CARVEOUT_GPU)