maccess-fix-strncpy_from_user_nofault-empty-string-handling.patch removed from -mm tree
The quilt patch titled
Subject: maccess: fix strncpy_from_user_nofault() empty string handling
has been removed from the -mm tree. Its filename was
maccess-fix-strncpy_from_user_nofault-empty-string-handling.patch
This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Mykyta Yatsenko <[email protected]>
Subject: maccess: fix strncpy_from_user_nofault() empty string handling
Date: Tue, 22 Apr 2025 14:14:49 +0100
strncpy_from_user_nofault() should return the length of the copied string including the trailing NUL, but if the argument unsafe_addr points to an empty string ({'\0'}), the return value is 0.
This happens as strncpy_from_user() copies terminal symbol into dst and returns 0 (as expected), but strncpy_from_user_nofault does not modify ret as it is not equal to count and not greater than 0, so 0 is returned, which contradicts the contract.
---
mm/maccess.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/maccess.c renamed from mm/maccess.c~maccess-fix-strncpy_from_user_nofault-empty-string-handling +1 -1
@@ -196,7 +196,7 @@ long strncpy_from_user_nofault(char *dstif (ret >= count) { ret = count; dst[ret -1 ] ='\0' ; - }else if (ret >0 ) { + }else if (ret >=0 ) { ret++; }
_
Patches currently in -mm which might be from [email protected] are