• Chen Li's avatar
    radeon: use kvcalloc for relocs and chunks · 0303e1b7
    Chen Li authored
    kvmalloc_array + __GFP_ZERO is the same with kvcalloc.
    
    As for p->chunks, it will be used in:
    ```
    if (ib_chunk->kdata)
    		memcpy(parser->ib.ptr, ib_chunk->kdata, ib_chunk->length_dw * 4);
    ```
    
    If chunks doesn't zero out with __GFP_ZERO, it may point to somewhere else, e.g.,
    ```
    Unable to handle kernel paging request at virtual address 0000000000010000
    ...
    pc is at memcpy+0x84/0x250
    ra is at radeon_cs_ioctl+0x368/0xb90 [radeon]
    ```
    
    after allocating chunks with __GFP_KERNEL/kvcalloc, this bug is fixed.
    Fixes: 3fcb4f01 ("drm/radeon: Use kvmalloc for CS chunks")
    Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
    Signed-off-by: default avatarChen Li <chenli@uniontech.com>
    Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
    0303e1b7
radeon_cs.c 23.2 KB