[RAMEN9610-12171] android: ion: fix assigning long to int
authorCho KyongHo <pullip.cho@samsung.com>
Fri, 23 Nov 2018 08:29:38 +0000 (17:29 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:23:16 +0000 (20:23 +0300)
This fixes SEC_INVALID_ASSIGNMENT_WITH_UNSIGNED_VALUES

Change-Id: I87124a4421b76cfb0e4060bb33c273f3cc879398
Signed-off-by: Cho KyongHo <pullip.cho@samsung.com>
drivers/staging/android/ion/ion_carveout_heap.c
drivers/staging/android/ion/ion_fdt_exynos.c
drivers/staging/android/ion/ion_hpa_heap.c

index c8cbbeabeee9257434a70ba292487a3ec7d00515..d26a020df8568077b9127532476a4a74b7851ae0 100644 (file)
@@ -186,7 +186,7 @@ static void carveout_heap_query(struct ion_heap *heap,
        struct ion_carveout_heap *carveout_heap =
                container_of(heap, struct ion_carveout_heap, heap);
 
-       data->size = carveout_heap->size;
+       data->size = (__u32)carveout_heap->size;
        if (carveout_heap->secure)
                data->heap_flags |= ION_HEAPDATA_FLAGS_ALLOW_PROTECTION;
        if (carveout_heap->untouchable)
index 2c946df5726be0fc7488543f86a46467106f586d..0fe013df81ecbd174268ceb3c8faa6be5244b689 100644 (file)
@@ -98,7 +98,7 @@ static int __init exynos_ion_reserved_mem_setup(struct reserved_mem *rmem)
        ion_reserved_mem[reserved_mem_count].base = rmem->base;
        ion_reserved_mem[reserved_mem_count].size = rmem->size;
        ion_reserved_mem[reserved_mem_count].heapname = heapname;
-       ion_reserved_mem[reserved_mem_count].alloc_align = alloc_align;
+       ion_reserved_mem[reserved_mem_count].alloc_align = (unsigned int)alloc_align;
        ion_reserved_mem[reserved_mem_count].protection_id = protection_id;
        ion_reserved_mem[reserved_mem_count].secure = secure;
        ion_reserved_mem[reserved_mem_count].untouchable = untch;
index 3a2384de932894240f3a87ad5576d5bb7a5df84a..4c548f5e65e6f65e52a72ca63a319267a8a6a3e8 100644 (file)
@@ -55,7 +55,8 @@ static int ion_hpa_allocate(struct ion_heap *heap,
                                 unsigned long flags)
 {
        struct ion_hpa_heap *hpa_heap = to_hpa_heap(heap);
-       unsigned int count = ION_HPA_PAGE_COUNT((unsigned int)len, hpa_heap);
+       unsigned int count =
+               (unsigned int)ION_HPA_PAGE_COUNT((unsigned int)len, hpa_heap);
        bool zero = !(flags & ION_FLAG_NOZEROED);
        bool cacheflush = !(flags & ION_FLAG_CACHED) ||
                          ((flags & ION_FLAG_SYNC_FORCE) != 0);