summaryrefslogtreecommitdiff
path: root/drivers/tty/vt
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-04-26 11:21:26 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-04-26 11:21:26 +0200
commit3702f72748b2cf91f5b7aefa4038e226f1a5fc81 (patch)
tree4ebb34f5051c59149d91ef564335ad004ebd905f /drivers/tty/vt
parente42e607aefc4132d508a0e5724b5d0975d0a53e8 (diff)
Revert "vt: minor cleanup to vc_translate_unicode()"
This reverts commit 74045f6658f11241a09d93404d79828cc99e94dc. A new version of the series was submitted, so it's easier to revert the old one and add the new one due to the changes invovled. Cc: Nicolas Pitre <nico@fluxnic.net> Cc: Jiri Slaby <jirislaby@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/vt')
-rw-r--r--drivers/tty/vt/vt.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index b5f3c8a818ed..f5642b3038e4 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -2817,7 +2817,7 @@ static int vc_translate_unicode(struct vc_data *vc, int c, bool *rescan)
if ((c & 0xc0) == 0x80) {
/* Unexpected continuation byte? */
if (!vc->vc_utf_count)
- goto bad_sequence;
+ return 0xfffd;
vc->vc_utf_char = (vc->vc_utf_char << 6) | (c & 0x3f);
vc->vc_npar++;
@@ -2829,17 +2829,17 @@ static int vc_translate_unicode(struct vc_data *vc, int c, bool *rescan)
/* Reject overlong sequences */
if (c <= utf8_length_changes[vc->vc_npar - 1] ||
c > utf8_length_changes[vc->vc_npar])
- goto bad_sequence;
+ return 0xfffd;
return vc_sanitize_unicode(c);
}
/* Single ASCII byte or first byte of a sequence received */
if (vc->vc_utf_count) {
- /* A continuation byte was expected */
+ /* Continuation byte expected */
*rescan = true;
vc->vc_utf_count = 0;
- goto bad_sequence;
+ return 0xfffd;
}
/* Nothing to do if an ASCII byte was received */
@@ -2858,14 +2858,11 @@ static int vc_translate_unicode(struct vc_data *vc, int c, bool *rescan)
vc->vc_utf_count = 3;
vc->vc_utf_char = (c & 0x07);
} else {
- goto bad_sequence;
+ return 0xfffd;
}
need_more_bytes:
return -1;
-
-bad_sequence:
- return 0xfffd;
}
static int vc_translate(struct vc_data *vc, int *c, bool *rescan)