提交 8377f818 编写于 作者: A Alex Elder 提交者: Andy Gross

soc: qcom: smem: fix off-by-one error in qcom_smem_alloc_private()

It's OK if the space for a newly-allocated uncached entry actually
touches the free cached space boundary.  It's only a problem if it
would cross it.
Signed-off-by: NAlex Elder <elder@linaro.org>
Reviewed-by: NBjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: NAndy Gross <andy.gross@linaro.org>
上级 04a512fe
...@@ -375,7 +375,7 @@ static int qcom_smem_alloc_private(struct qcom_smem *smem, ...@@ -375,7 +375,7 @@ static int qcom_smem_alloc_private(struct qcom_smem *smem,
/* Check that we don't grow into the cached region */ /* Check that we don't grow into the cached region */
alloc_size = sizeof(*hdr) + ALIGN(size, 8); alloc_size = sizeof(*hdr) + ALIGN(size, 8);
if ((void *)hdr + alloc_size >= cached) { if ((void *)hdr + alloc_size > cached) {
dev_err(smem->dev, "Out of memory\n"); dev_err(smem->dev, "Out of memory\n");
return -ENOSPC; return -ENOSPC;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册