[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202009151322.EGgsJItW%lkp@intel.com>
Date: Tue, 15 Sep 2020 13:54:35 +0800
From: kernel test robot <lkp@...el.com>
To: Luc Van Oostenryck <luc.vanoostenryck@...il.com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Subject: drivers/tty/vt/vt_ioctl.c:1004:21: sparse: sparse: incorrect type in
argument 1 (different address spaces)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: fc4f28bb3daf3265d6bc5f73b497306985bb23ab
commit: e5fc436f06eef54ef512ea55a9db8eb9f2e76959 sparse: use static inline for __chk_{user,io}_ptr()
date: 2 weeks ago
config: sh-randconfig-s031-20200913 (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-191-g10164920-dirty
git checkout e5fc436f06eef54ef512ea55a9db8eb9f2e76959
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=sh
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
sparse warnings: (new ones prefixed by >>)
drivers/tty/vt/vt_ioctl.c:1004:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned short const *__gu_addr @@ got unsigned short [noderef] __user * @@
drivers/tty/vt/vt_ioctl.c:1004:21: sparse: expected unsigned short const *__gu_addr
drivers/tty/vt/vt_ioctl.c:1004:21: sparse: got unsigned short [noderef] __user *
>> drivers/tty/vt/vt_ioctl.c:1004:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned short const *__gu_addr @@
>> drivers/tty/vt/vt_ioctl.c:1004:21: sparse: expected void const volatile [noderef] __user *ptr
drivers/tty/vt/vt_ioctl.c:1004:21: sparse: got unsigned short const *__gu_addr
drivers/tty/vt/vt_ioctl.c:1005:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned short const *__gu_addr @@ got unsigned short [noderef] __user * @@
drivers/tty/vt/vt_ioctl.c:1005:21: sparse: expected unsigned short const *__gu_addr
drivers/tty/vt/vt_ioctl.c:1005:21: sparse: got unsigned short [noderef] __user *
drivers/tty/vt/vt_ioctl.c:1005:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned short const *__gu_addr @@
drivers/tty/vt/vt_ioctl.c:1005:21: sparse: expected void const volatile [noderef] __user *ptr
drivers/tty/vt/vt_ioctl.c:1005:21: sparse: got unsigned short const *__gu_addr
--
drivers/tty/vt/vt.c:4301:13: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected char const *__gu_addr @@ got char [noderef] __user * @@
drivers/tty/vt/vt.c:4301:13: sparse: expected char const *__gu_addr
drivers/tty/vt/vt.c:4301:13: sparse: got char [noderef] __user *
>> drivers/tty/vt/vt.c:4301:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got char const *__gu_addr @@
>> drivers/tty/vt/vt.c:4301:13: sparse: expected void const volatile [noderef] __user *ptr
drivers/tty/vt/vt.c:4301:13: sparse: got char const *__gu_addr
drivers/tty/vt/vt.c:225:5: sparse: sparse: symbol 'console_blank_hook' was not declared. Should it be static?
drivers/tty/vt/vt.c:2991:19: sparse: sparse: symbol 'console_driver' was not declared. Should it be static?
drivers/tty/vt/vt.c:3147:13: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected char const *__gu_addr @@ got char [noderef] __user *p @@
drivers/tty/vt/vt.c:3147:13: sparse: expected char const *__gu_addr
drivers/tty/vt/vt.c:3147:13: sparse: got char [noderef] __user *p
drivers/tty/vt/vt.c:3147:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got char const *__gu_addr @@
drivers/tty/vt/vt.c:3147:13: sparse: expected void const volatile [noderef] __user *ptr
drivers/tty/vt/vt.c:3147:13: sparse: got char const *__gu_addr
drivers/tty/vt/vt.c:3200:37: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected char const *__gu_addr @@ got char [noderef] __user * @@
drivers/tty/vt/vt.c:3200:37: sparse: expected char const *__gu_addr
drivers/tty/vt/vt.c:3200:37: sparse: got char [noderef] __user *
drivers/tty/vt/vt.c:3200:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got char const *__gu_addr @@
drivers/tty/vt/vt.c:3200:37: sparse: expected void const volatile [noderef] __user *ptr
drivers/tty/vt/vt.c:3200:37: sparse: got char const *__gu_addr
drivers/tty/vt/vt.c:3213:29: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected signed int const *__gu_addr @@ got signed int [noderef] [usertype] __user * @@
drivers/tty/vt/vt.c:3213:29: sparse: expected signed int const *__gu_addr
drivers/tty/vt/vt.c:3213:29: sparse: got signed int [noderef] [usertype] __user *
>> drivers/tty/vt/vt.c:3213:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got signed int const *__gu_addr @@
drivers/tty/vt/vt.c:3213:29: sparse: expected void const volatile [noderef] __user *ptr
drivers/tty/vt/vt.c:3213:29: sparse: got signed int const *__gu_addr
drivers/tty/vt/vt.c:3032:13: sparse: sparse: context imbalance in 'vt_console_print' - wrong count at exit
--
drivers/tty/vt/keyboard.c:1730:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const *__gu_addr @@ got unsigned int [noderef] __user * @@
drivers/tty/vt/keyboard.c:1730:21: sparse: expected unsigned int const *__gu_addr
drivers/tty/vt/keyboard.c:1730:21: sparse: got unsigned int [noderef] __user *
>> drivers/tty/vt/keyboard.c:1730:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned int const *__gu_addr @@
>> drivers/tty/vt/keyboard.c:1730:21: sparse: expected void const volatile [noderef] __user *ptr
drivers/tty/vt/keyboard.c:1730:21: sparse: got unsigned int const *__gu_addr
drivers/tty/vt/keyboard.c:1768:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const *__gu_addr @@ got unsigned int [noderef] __user * @@
drivers/tty/vt/keyboard.c:1768:21: sparse: expected unsigned int const *__gu_addr
drivers/tty/vt/keyboard.c:1768:21: sparse: got unsigned int [noderef] __user *
drivers/tty/vt/keyboard.c:1768:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned int const *__gu_addr @@
drivers/tty/vt/keyboard.c:1768:21: sparse: expected void const volatile [noderef] __user *ptr
drivers/tty/vt/keyboard.c:1768:21: sparse: got unsigned int const *__gu_addr
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e5fc436f06eef54ef512ea55a9db8eb9f2e76959
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout e5fc436f06eef54ef512ea55a9db8eb9f2e76959
vim +1004 drivers/tty/vt/vt_ioctl.c
5422337d569ead drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 821
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 822 /*
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 823 * We handle the console-specific ioctl's here. We allow the
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 824 * capability to modify any console, not just the fg_console.
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 825 */
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 826 int vt_ioctl(struct tty_struct *tty,
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 827 unsigned int cmd, unsigned long arg)
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 828 {
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 829 struct vc_data *vc = tty->driver_data;
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 830 void __user *up = (void __user *)arg;
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 831 int i, perm;
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 832 int ret;
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 833
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 834 /*
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 835 * To have permissions to do most of the vt ioctls, we either have
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 836 * to be the owner of the tty, or have CAP_SYS_TTY_CONFIG.
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 837 */
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 838 perm = 0;
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 839 if (current->signal->tty == tty || capable(CAP_SYS_TTY_CONFIG))
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 840 perm = 1;
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 841
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 842 ret = vt_k_ioctl(tty, cmd, arg, perm);
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 843 if (ret != -ENOIOCTLCMD)
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 844 return ret;
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 845
bfbbdfa4de133e drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 846 ret = vt_io_ioctl(vc, cmd, up, perm);
bfbbdfa4de133e drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 847 if (ret != -ENOIOCTLCMD)
bfbbdfa4de133e drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 848 return ret;
bfbbdfa4de133e drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 849
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 850 switch (cmd) {
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 851 case TIOCLINUX:
832a62ab6b7d32 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 852 return tioclinux(tty, arg);
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 853 case VT_SETMODE:
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 854 {
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 855 struct vt_mode tmp;
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 856
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 857 if (!perm)
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox 2012-03-02 858 return -EPERM;
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 859 if (copy_from_user(&tmp, up, sizeof(struct vt_mode)))
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 860 return -EFAULT;
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 861 if (tmp.mode != VT_AUTO && tmp.mode != VT_PROCESS)
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 862 return -EINVAL;
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 863
ac751efa6a0d70 drivers/tty/vt/vt_ioctl.c Torben Hohn 2011-01-25 864 console_lock();
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 865 vc->vt_mode = tmp;
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 866 /* the frsig is ignored, so we set it to 0 */
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 867 vc->vt_mode.frsig = 0;
8b6312f4dcc1ef drivers/char/vt_ioctl.c Eric W. Biederman 2007-02-10 868 put_pid(vc->vt_pid);
8b6312f4dcc1ef drivers/char/vt_ioctl.c Eric W. Biederman 2007-02-10 869 vc->vt_pid = get_pid(task_pid(current));
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 870 /* no switch is required -- saw@...de.msu.ru */
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 871 vc->vt_newvt = -1;
ac751efa6a0d70 drivers/tty/vt/vt_ioctl.c Torben Hohn 2011-01-25 872 console_unlock();
9cc3c22bf017f3 drivers/char/vt_ioctl.c Alan Cox 2008-04-30 873 break;
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 874 }
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 875
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 876 case VT_GETMODE:
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 877 {
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 878 struct vt_mode tmp;
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 879 int rc;
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 880
ac751efa6a0d70 drivers/tty/vt/vt_ioctl.c Torben Hohn 2011-01-25 881 console_lock();
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 882 memcpy(&tmp, &vc->vt_mode, sizeof(struct vt_mode));
ac751efa6a0d70 drivers/tty/vt/vt_ioctl.c Torben Hohn 2011-01-25 883 console_unlock();
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 884
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 885 rc = copy_to_user(up, &tmp, sizeof(struct vt_mode));
9cc3c22bf017f3 drivers/char/vt_ioctl.c Alan Cox 2008-04-30 886 if (rc)
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 887 return -EFAULT;
9cc3c22bf017f3 drivers/char/vt_ioctl.c Alan Cox 2008-04-30 888 break;
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 889 }
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 890
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 891 /*
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 892 * Returns global vt state. Note that VT 0 is always open, since
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 893 * it's an alias for the current VT, and people can't use it here.
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 894 * We cannot return state for more than 16 VTs, since v_state is short.
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 895 */
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 896 case VT_GETSTATE:
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 897 {
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 898 struct vt_stat __user *vtstat = up;
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 899 unsigned short state, mask;
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 900
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 901 if (put_user(fg_console + 1, &vtstat->v_active))
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 902 return -EFAULT;
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 903
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 904 state = 1; /* /dev/tty0 is always open */
7cf64b18b0b96e drivers/tty/vt/vt_ioctl.c Eric Biggers 2020-03-21 905 console_lock(); /* required by vt_in_use() */
9cc3c22bf017f3 drivers/char/vt_ioctl.c Alan Cox 2008-04-30 906 for (i = 0, mask = 2; i < MAX_NR_CONSOLES && mask;
9cc3c22bf017f3 drivers/char/vt_ioctl.c Alan Cox 2008-04-30 907 ++i, mask <<= 1)
e587e8f17433dd drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-02-19 908 if (vt_in_use(i))
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 909 state |= mask;
7cf64b18b0b96e drivers/tty/vt/vt_ioctl.c Eric Biggers 2020-03-21 910 console_unlock();
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 911 return put_user(state, &vtstat->v_state);
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 912 }
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 913
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 914 /*
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 915 * Returns the first available (non-opened) console.
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 916 */
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 917 case VT_OPENQRY:
7cf64b18b0b96e drivers/tty/vt/vt_ioctl.c Eric Biggers 2020-03-21 918 console_lock(); /* required by vt_in_use() */
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 919 for (i = 0; i < MAX_NR_CONSOLES; ++i)
e587e8f17433dd drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-02-19 920 if (!vt_in_use(i))
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 921 break;
7cf64b18b0b96e drivers/tty/vt/vt_ioctl.c Eric Biggers 2020-03-21 922 console_unlock();
eca734d8f0043e drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 923 i = i < MAX_NR_CONSOLES ? (i+1) : -1;
eca734d8f0043e drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 924 return put_user(i, (int __user *)arg);
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 925
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 926 /*
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 927 * ioctl(fd, VT_ACTIVATE, num) will cause us to switch to vt # num,
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 928 * with num >= 1 (switches to vt 0, our console, are not allowed, just
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 929 * to preserve sanity).
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 930 */
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 931 case VT_ACTIVATE:
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 932 if (!perm)
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox 2012-03-02 933 return -EPERM;
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 934 if (arg == 0 || arg > MAX_NR_CONSOLES)
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 935 return -ENXIO;
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 936
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 937 arg--;
ac751efa6a0d70 drivers/tty/vt/vt_ioctl.c Torben Hohn 2011-01-25 938 console_lock();
9cc3c22bf017f3 drivers/char/vt_ioctl.c Alan Cox 2008-04-30 939 ret = vc_allocate(arg);
ac751efa6a0d70 drivers/tty/vt/vt_ioctl.c Torben Hohn 2011-01-25 940 console_unlock();
9cc3c22bf017f3 drivers/char/vt_ioctl.c Alan Cox 2008-04-30 941 if (ret)
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 942 return ret;
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 943 set_console(arg);
9cc3c22bf017f3 drivers/char/vt_ioctl.c Alan Cox 2008-04-30 944 break;
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 945
d3b5cffcf84a8b drivers/char/vt_ioctl.c Alan Cox 2009-09-19 946 case VT_SETACTIVATE:
d3b5cffcf84a8b drivers/char/vt_ioctl.c Alan Cox 2009-09-19 947 if (!perm)
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox 2012-03-02 948 return -EPERM;
d3b5cffcf84a8b drivers/char/vt_ioctl.c Alan Cox 2009-09-19 949
ebf1efbb1a7f79 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 950 return vt_setactivate(up);
d3b5cffcf84a8b drivers/char/vt_ioctl.c Alan Cox 2009-09-19 951
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 952 /*
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 953 * wait until the specified VT has been activated
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 954 */
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 955 case VT_WAITACTIVE:
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 956 if (!perm)
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox 2012-03-02 957 return -EPERM;
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 958 if (arg == 0 || arg > MAX_NR_CONSOLES)
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 959 return -ENXIO;
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 960 return vt_waitactive(arg);
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 961
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 962 /*
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 963 * If a vt is under process control, the kernel will not switch to it
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 964 * immediately, but postpone the operation until the process calls this
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 965 * ioctl, allowing the switch to complete.
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 966 *
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 967 * According to the X sources this is the behavior:
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 968 * 0: pending switch-from not OK
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 969 * 1: pending switch-from OK
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 970 * 2: completed switch-to OK
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 971 */
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 972 case VT_RELDISP:
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 973 if (!perm)
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox 2012-03-02 974 return -EPERM;
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 975
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox 2012-03-02 976 console_lock();
535082d9078d0b drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 977 ret = vt_reldisp(vc, arg);
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox 2012-03-02 978 console_unlock();
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 979
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 980 return ret;
535082d9078d0b drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 981
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 982
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 983 /*
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 984 * Disallocate memory associated to VT (but leave VT1)
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 985 */
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 986 case VT_DISALLOCATE:
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 987 if (arg > MAX_NR_CONSOLES)
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 988 return -ENXIO;
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 989
421b40a6286ee3 drivers/tty/vt/vt_ioctl.c Peter Hurley 2013-05-17 990 if (arg == 0)
421b40a6286ee3 drivers/tty/vt/vt_ioctl.c Peter Hurley 2013-05-17 991 vt_disallocate_all();
421b40a6286ee3 drivers/tty/vt/vt_ioctl.c Peter Hurley 2013-05-17 992 else
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 993 return vt_disallocate(--arg);
9cc3c22bf017f3 drivers/char/vt_ioctl.c Alan Cox 2008-04-30 994 break;
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 995
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 996 case VT_RESIZE:
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 997 {
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 998 struct vt_sizes __user *vtsizes = up;
e400b6ec4ede4d drivers/char/vt_ioctl.c Antonino A. Daplas 2007-10-16 999 struct vc_data *vc;
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 1000 ushort ll,cc;
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 1001
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 1002 if (!perm)
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox 2012-03-02 1003 return -EPERM;
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 @1004 if (get_user(ll, &vtsizes->v_rows) ||
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 1005 get_user(cc, &vtsizes->v_cols))
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 1006 return -EFAULT;
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 1007
ac751efa6a0d70 drivers/tty/vt/vt_ioctl.c Torben Hohn 2011-01-25 1008 console_lock();
e400b6ec4ede4d drivers/char/vt_ioctl.c Antonino A. Daplas 2007-10-16 1009 for (i = 0; i < MAX_NR_CONSOLES; i++) {
e400b6ec4ede4d drivers/char/vt_ioctl.c Antonino A. Daplas 2007-10-16 1010 vc = vc_cons[i].d;
e400b6ec4ede4d drivers/char/vt_ioctl.c Antonino A. Daplas 2007-10-16 1011
e400b6ec4ede4d drivers/char/vt_ioctl.c Antonino A. Daplas 2007-10-16 1012 if (vc) {
e400b6ec4ede4d drivers/char/vt_ioctl.c Antonino A. Daplas 2007-10-16 1013 vc->vc_resize_user = 1;
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox 2012-03-02 1014 /* FIXME: review v tty lock */
8c9a9dd0fa3a26 drivers/char/vt_ioctl.c Alan Cox 2008-08-15 1015 vc_resize(vc_cons[i].d, cc, ll);
e400b6ec4ede4d drivers/char/vt_ioctl.c Antonino A. Daplas 2007-10-16 1016 }
e400b6ec4ede4d drivers/char/vt_ioctl.c Antonino A. Daplas 2007-10-16 1017 }
ac751efa6a0d70 drivers/tty/vt/vt_ioctl.c Torben Hohn 2011-01-25 1018 console_unlock();
9cc3c22bf017f3 drivers/char/vt_ioctl.c Alan Cox 2008-04-30 1019 break;
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 1020 }
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 1021
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 1022 case VT_RESIZEX:
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 1023 if (!perm)
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox 2012-03-02 1024 return -EPERM;
6cd1ed50efd882 drivers/tty/vt/vt_ioctl.c Eric Dumazet 2020-02-10 1025
5422337d569ead drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 1026 return vt_resizex(vc, up);
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 1027
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 1028 case VT_LOCKSWITCH:
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 1029 if (!capable(CAP_SYS_TTY_CONFIG))
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox 2012-03-02 1030 return -EPERM;
f400991bf872de drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-02-19 1031 vt_dont_switch = true;
9cc3c22bf017f3 drivers/char/vt_ioctl.c Alan Cox 2008-04-30 1032 break;
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 1033 case VT_UNLOCKSWITCH:
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 1034 if (!capable(CAP_SYS_TTY_CONFIG))
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox 2012-03-02 1035 return -EPERM;
f400991bf872de drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-02-19 1036 vt_dont_switch = false;
9cc3c22bf017f3 drivers/char/vt_ioctl.c Alan Cox 2008-04-30 1037 break;
533475d3d48eb8 drivers/char/vt_ioctl.c Samuel Thibault 2006-08-27 1038 case VT_GETHIFONTMASK:
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 1039 return put_user(vc->vc_hi_font_mask,
9cc3c22bf017f3 drivers/char/vt_ioctl.c Alan Cox 2008-04-30 1040 (unsigned short __user *)arg);
8b92e87d39bfd0 drivers/char/vt_ioctl.c Alan Cox 2009-09-19 1041 case VT_WAITEVENT:
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 1042 return vt_event_wait_ioctl((struct vt_event __user *)arg);
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 1043 default:
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 1044 return -ENOIOCTLCMD;
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 1045 }
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 1046
0ce8179e248023 drivers/tty/vt/vt_ioctl.c Jiri Slaby 2020-06-15 1047 return 0;
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 1048 }
^1da177e4c3f41 drivers/char/vt_ioctl.c Linus Torvalds 2005-04-16 1049
:::::: The code at line 1004 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
:::::: TO: Linus Torvalds <torvalds@...970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@...970.osdl.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (25098 bytes)
Powered by blists - more mailing lists