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: Alex Elder <elder@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Andy Gross <andy.gross@linaro.org>
This commit is contained in:
Alex Elder 2018-04-10 17:25:40 -05:00 коммит произвёл Andy Gross
Родитель 04a512fea3
Коммит 8377f8181d
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -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;
}