Skip to contentSkip to conversation

mm-damon-sysfs-schemes-use-strscpy-to-instead-of-strncpy.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Jan 19, 2023

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/damon/sysfs-schemes: use strscpy() to instead of strncpy()
has been removed from the -mm tree. Its filename was
mm-damon-sysfs-schemes-use-strscpy-to-instead-of-strncpy.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Xu Panda <[email protected]>
Subject: mm/damon/sysfs-schemes: use strscpy() to instead of strncpy()
Date: Mon, 9 Jan 2023 19:46:55 +0800 (CST)

The implementation of strscpy() is more robust and safer. That's now the recommended way to copy NUL-terminated strings.

---

 mm/damon/sysfs-schemes.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
mm/damon/sysfs-schemes.c renamed from mm/damon/sysfs-schemes.c~mm-damon-sysfs-schemes-use-strscpy-to-instead-of-strncpy +1 -2
@@ -353,8 +353,7 @@ static ssize_t memcg_path_store(struct k
 	if (!path)
 		return -ENOMEM;
 
-	strncpy(path, buf, count);
-	path[count] = '\0';
+	strscpy(path, buf, count + 1);
 	filter->memcg_path = path;
 	return count;
 }

_

Patches currently in -mm which might be from [email protected] are