From 53d312da45a0a3e262b37d313aeb3bee3ff5e091 Mon Sep 17 00:00:00 2001 From: "Isaac J. Manjarres" Date: Tue, 16 Jun 2020 10:52:24 -0700 Subject: [PATCH] soc: qcom: mem-buf: Treat zero-sized sg-lists as invalid inputs When unmapping memory in S1, treat zero-sized sg-lists as invalid inputs. Change-Id: I477cd0808eea1200873c50470c8b73d9162428e4 Signed-off-by: Isaac J. Manjarres --- drivers/soc/qcom/mem-buf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/soc/qcom/mem-buf.c b/drivers/soc/qcom/mem-buf.c index 18d2bcd31b83..9ffe23127f25 100644 --- a/drivers/soc/qcom/mem-buf.c +++ b/drivers/soc/qcom/mem-buf.c @@ -992,7 +992,7 @@ static int mem_buf_map_mem_s1(struct hh_sgl_desc *sgl_desc) u64 base, size; struct mhp_restrictions restrictions = {}; - if (!sgl_desc) + if (!sgl_desc || !sgl_desc->n_sgl_entries) return -EINVAL; pr_debug("%s: Creating CPU MMU stage 1 mappings\n", __func__); @@ -1048,7 +1048,7 @@ static int mem_buf_unmap_mem_s1(struct hh_sgl_desc *sgl_desc) unsigned int i, nid; u64 base, size; - if (!sgl_desc) + if (!sgl_desc || !sgl_desc->n_sgl_entries) return -EINVAL; pr_debug("%s: Removing CPU MMU stage 1 mappings\n", __func__);