[PATCH v2 02/10] lib/ucs2_string: Drop arbitrary input size limit and associated WARN()
From: Ard Biesheuvel
Date: Wed Sep 09 2026 - 08:20:39 EST
From: Ard Biesheuvel <ardb@xxxxxxxxxx>
It's not really the job of library code to WARN and potentially bring
down the system (with panic_on_warn=1) on a condition that is fairly
arbitrary to begin with.
So drop the WARN_ON_ONCE() as well as the condition from ucs2_strscpy().
Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx>
---
lib/ucs2_string.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/ucs2_string.c b/lib/ucs2_string.c
index 1f7dd4eb640a..d66fef9c9b81 100644
--- a/lib/ucs2_string.c
+++ b/lib/ucs2_string.c
@@ -57,7 +57,7 @@ ssize_t ucs2_strscpy(ucs2_char_t *dst, const ucs2_char_t *src, size_t count)
* Ensure that we have a valid amount of space. We need to store at
* least one NUL-character.
*/
- if (count == 0 || WARN_ON_ONCE(count > INT_MAX / sizeof(*dst)))
+ if (count == 0)
return -E2BIG;
/*
--
2.55.0.1003.g10538fe699-goog