[PATCH 2/7] lib/ucs2_string: Avoid WARN in library code
From: Ard Biesheuvel
Date: Sun Sep 06 2026 - 09:08:54 EST
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 really
not something to obsess over.
So drop the WARN_ON_ONCE() 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..d391c9d8eba5 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 || count > INT_MAX / sizeof(*dst))
return -E2BIG;
/*
--
2.47.3