Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 877ad644 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ADSPRPC: Size check before allocating memory from DMA"

parents 102906e2 e9310765
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -663,12 +663,20 @@ static int fastrpc_mmap_find(struct fastrpc_file *fl, int fd,
static int dma_alloc_memory(dma_addr_t *region_phys, void **vaddr, size_t size,
			unsigned long dma_attrs)
{
	int err = 0;
	struct fastrpc_apps *me = &gfa;

	if (me->dev == NULL) {
		pr_err("device adsprpc-mem is not initialized\n");
		return -ENODEV;
	}
	VERIFY(err, size > 0 && size < MAX_SIZE_LIMIT);
	if (err) {
		err = -EFAULT;
		pr_err("adsprpc: %s: invalid allocation size 0x%zx\n",
			__func__, size);
		return err;
	}
	*vaddr = dma_alloc_attrs(me->dev, size, region_phys, GFP_KERNEL,
								dma_attrs);
	if (IS_ERR_OR_NULL(*vaddr)) {