[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211013114854.15705-1-xhao@linux.alibaba.com>
Date: Wed, 13 Oct 2021 19:48:54 +0800
From: Xin Hao <xhao@...ux.alibaba.com>
To: sjpark@...zon.de
Cc: xhao@...ux.alibaba.com, akpm@...ux-foundation.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: [PATCH] mm/damon: Adjust the size of kbuf array to avoid overflow
In order to avoid the 'count' size space of kbuf array is
used up, but a "\0" is still added.
Signed-off-by: Xin Hao <xhao@...ux.alibaba.com>
---
mm/damon/dbgfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/damon/dbgfs.c b/mm/damon/dbgfs.c
index faee070977d8..20c61eed54af 100644
--- a/mm/damon/dbgfs.c
+++ b/mm/damon/dbgfs.c
@@ -247,7 +247,7 @@ static ssize_t dbgfs_kdamond_pid_read(struct file *file,
char *kbuf;
ssize_t len;
- kbuf = kmalloc(count, GFP_KERNEL);
+ kbuf = kmalloc(count + 1, GFP_KERNEL);
if (!kbuf)
return -ENOMEM;
--
2.31.0
Powered by blists - more mailing lists