lkml.org 
[lkml]   [2018]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 4/6] soc: qcom: smem: fix off-by-one error in qcom_smem_alloc_private()
Date
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>
---
drivers/soc/qcom/smem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
index 82f0908b90e1..0ed263055988 100644
--- a/drivers/soc/qcom/smem.c
+++ b/drivers/soc/qcom/smem.c
@@ -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;
}
--
2.14.1
\
 
 \ /
  Last update: 2018-04-11 01:43    [W:0.111 / U:9.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site