nls: utf8_wcstombs: use correct buffer size in error case
When utf8_wcstombs encounters a character that cannot be encoded, we
must not decrease the remaining output buffer size because nothing has
been written to the output buffer.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
diff --git a/fs/nls/nls_base.c b/fs/nls/nls_base.c
index 9b0efda..000736d 100644
--- a/fs/nls/nls_base.c
+++ b/fs/nls/nls_base.c
@@ -144,7 +144,6 @@
size = utf8_wctomb(op, *ip, maxlen);
if (size == -1) {
/* Ignore character and move on */
- maxlen--;
} else {
op += size;
maxlen -= size;