The allocated memory with kmalloc() can have invalid value. To
avoid using the invalid value, always set cached element.
This removes below UBSAN warning:
UBSAN: Undefined behaviour in drivers/staging/android/ion/ion_page_pool.c:33:11
load of value 152 is not a valid value for type '_Bool'
...
[<
ffffff9009b89e48>] __ubsan_handle_load_invalid_value+0x80/0x90
[<
ffffff900a2c4044>] ion_page_pool_alloc+0x154/0x180
[<
ffffff900a2c5b60>] ion_system_heap_allocate+0x2b8/0xa68
[<
ffffff900a2c0688>] ion_alloc+0x238/0x9c8
...
Change-Id: I86e0ee70404bb074dad3b73dccec31ebcf2c7c72
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
pool->order = order;
mutex_init(&pool->mutex);
plist_node_init(&pool->list, order);
- if (cached)
- pool->cached = true;
+ pool->cached = cached;
return pool;
}