Commit 8377f818 authored by Alex Elder's avatar Alex Elder Committed by 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: default avatarAlex Elder <elder@linaro.org>
Reviewed-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: default avatarAndy Gross <andy.gross@linaro.org>
parent 04a512fe
......@@ -375,7 +375,7 @@ static int qcom_smem_alloc_private(struct qcom_smem *smem,
/* Check that we don't grow into the cached region */
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");
return -ENOSPC;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment