On Mon, Sep 30, 2019 at 12:43 AM Hillf Danton hdanton@sina.com wrote:
On Fri, 6 Sep 2019 18:47:09 +0000 John Stultz wrote:
+static int system_heap_allocate(struct dma_heap *heap,
unsigned long len,
unsigned long fd_flags,
unsigned long heap_flags)
+{
struct heap_helper_buffer *helper_buffer;
struct dma_buf *dmabuf;
int ret = -ENOMEM;
pgoff_t pg;
helper_buffer = kzalloc(sizeof(*helper_buffer), GFP_KERNEL);
if (!helper_buffer)
return -ENOMEM;
init_heap_helper_buffer(helper_buffer, system_heap_free);
helper_buffer->flags = heap_flags;
helper_buffer->heap = heap;
helper_buffer->size = len;
A couple of lines looks needed to handle len if it is not PAGE_SIZE aligned.
Hey! Thanks so much for the review!
dma_heap_buffer_alloc() sets "len = PAGE_ALIGN(len);" before calling into the heap allocation hook. So hopefully this isn't a concern, or am I missing something?
thanks -john