Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dma-buf: align fd_flags and heap_flags with dma_heap_allocation_data

dma_heap_allocation_data defines the UAPI as follows:

struct dma_heap_allocation_data {
__u64 len;
__u32 fd;
__u32 fd_flags;
__u64 heap_flags;
};

However, dma_heap_buffer_alloc() casts both fd_flags and heap_flags
into unsigned int. We're inconsistent with types in the non UAPI
arguments. This patch fixes it.

Signed-off-by: Barry Song <v-songbaohua@oppo.com>
Acked-by: John Stultz <jstultz@google.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240605012605.5341-1-21cnbao@gmail.com

authored by

Barry Song and committed by
Sumit Semwal
310ec038 9c3951ec

+3 -3
+2 -2
drivers/dma-buf/dma-heap.c
··· 50 50 static DEFINE_XARRAY_ALLOC(dma_heap_minors); 51 51 52 52 static int dma_heap_buffer_alloc(struct dma_heap *heap, size_t len, 53 - unsigned int fd_flags, 54 - unsigned int heap_flags) 53 + u32 fd_flags, 54 + u64 heap_flags) 55 55 { 56 56 struct dma_buf *dmabuf; 57 57 int fd;
+1 -1
include/uapi/linux/dma-heap.h
··· 19 19 #define DMA_HEAP_VALID_FD_FLAGS (O_CLOEXEC | O_ACCMODE) 20 20 21 21 /* Currently no heap flags */ 22 - #define DMA_HEAP_VALID_HEAP_FLAGS (0) 22 + #define DMA_HEAP_VALID_HEAP_FLAGS (0ULL) 23 23 24 24 /** 25 25 * struct dma_heap_allocation_data - metadata passed from userspace for