public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH linux-next] init/do_mounts: fix potential memory out of bounds access
@ 2021-09-13 11:43 cgel.zte
  2021-09-14 20:23 ` Jan Kara
  0 siblings, 1 reply; 4+ messages in thread
From: cgel.zte @ 2021-09-13 11:43 UTC (permalink / raw)
  To: hare
  Cc: axboe, jack, tj, viro, xu.xin16, linux-kernel, Zeal Robot,
	zhang yunkai

From: xu xin <xu.xin16@zte.com.cn>

Initially the pointer "p" points to the start of "pages".
In the loop "while(*p++) {...}", it ends when "*p" equals
to zero. Just after that, the pointer "p" moves forward
with "p++", so "p" may points ouf of "pages".

furthermore, it is no use to set *p = '\0', so we remove it.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Acked-by: zhang yunkai<zhang.yunkai@zte.com.cn>
Signed-off-by: xu xin <xu.xin16@zte.com.cn>
---
 init/do_mounts.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/init/do_mounts.c b/init/do_mounts.c
index 2ed30ff6c906..ee1172599249 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -348,7 +348,6 @@ static int __init split_fs_names(char *page, char *names)
 		if (p[-1] == ',')
 			p[-1] = '\0';
 	}
-	*p = '\0';
 
 	for (p = page; *p; p += strlen(p)+1)
 		count++;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-14 23:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-13 11:43 [PATCH linux-next] init/do_mounts: fix potential memory out of bounds access cgel.zte
2021-09-14 20:23 ` Jan Kara
2021-09-14 22:41   ` Vivek Goyal
2021-09-14 23:14     ` Vivek Goyal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox