summaryrefslogtreecommitdiff
path: root/drivers/tty/vt/vt_ioctl.c
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2022-05-19 11:02:10 -0300
committerGitHub <noreply@github.com>2022-05-19 11:02:10 -0300
commitb7007e1d615b8d4b71c28ebf790c5164fc4491d5 (patch)
tree48c35f63dc1101d0d528b5d79c81849b99ca7c6d /drivers/tty/vt/vt_ioctl.c
parent38955ef654554c94f4d91bafb9ef5c5f41a4c0f6 (diff)
parent0e61b511dd8474280ba674590daa55f30433b7d4 (diff)
Merge pull request #565 from philschenker/update-to-5.4.193__update-to-2.3.7__5.4-2.3.x-imx
Update Patchlevel on Branch 5.4-2.3.x-imx from 5.4.161->5.4.193
Diffstat (limited to 'drivers/tty/vt/vt_ioctl.c')
-rw-r--r--drivers/tty/vt/vt_ioctl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c
index 167c72726c5a..312857168dad 100644
--- a/drivers/tty/vt/vt_ioctl.c
+++ b/drivers/tty/vt/vt_ioctl.c
@@ -691,6 +691,7 @@ int vt_ioctl(struct tty_struct *tty,
ret = -ENXIO;
else {
arg--;
+ arg = array_index_nospec(arg, MAX_NR_CONSOLES);
console_lock();
ret = vc_allocate(arg);
console_unlock();
@@ -715,9 +716,9 @@ int vt_ioctl(struct tty_struct *tty,
if (vsa.console == 0 || vsa.console > MAX_NR_CONSOLES)
ret = -ENXIO;
else {
- vsa.console = array_index_nospec(vsa.console,
- MAX_NR_CONSOLES + 1);
vsa.console--;
+ vsa.console = array_index_nospec(vsa.console,
+ MAX_NR_CONSOLES);
console_lock();
ret = vc_allocate(vsa.console);
if (ret == 0) {