lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202007251634.UcUQ0OG1%lkp@intel.com>
Date:   Sat, 25 Jul 2020 16:47:48 +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
Subject: drivers/tty/vt/vt_ioctl.c:411:23: sparse: sparse: incorrect type in
 initializer (different address spaces)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   23ee3e4e5bd27bdbc0f1785eef7209ce872794c7
commit: 670d0a4b10704667765f7d18f7592993d02783aa sparse: use identifiers to define address spaces
date:   5 weeks ago
config: openrisc-randconfig-s032-20200725 (attached as .config)
compiler: or1k-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-93-g4c6cbe55-dirty
        git checkout 670d0a4b10704667765f7d18f7592993d02783aa
        # 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=openrisc 

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:411:23: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected char *__pu_addr @@     got char [noderef] __user * @@
   drivers/tty/vt/vt_ioctl.c:411:23: sparse:     expected char *__pu_addr
>> drivers/tty/vt/vt_ioctl.c:411:23: sparse:     got char [noderef] __user *
>> drivers/tty/vt/vt_ioctl.c:527:23: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int *__pu_addr @@     got int [noderef] __user * @@
   drivers/tty/vt/vt_ioctl.c:527:23: sparse:     expected int *__pu_addr
>> drivers/tty/vt/vt_ioctl.c:527:23: sparse:     got int [noderef] __user *
   drivers/tty/vt/vt_ioctl.c:540:23: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected int *__pu_addr @@     got int [noderef] __user * @@
   drivers/tty/vt/vt_ioctl.c:540:23: sparse:     expected int *__pu_addr
   drivers/tty/vt/vt_ioctl.c:540:23: sparse:     got int [noderef] __user *
>> drivers/tty/vt/vt_ioctl.c:652:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned short *__pu_addr @@     got unsigned short [noderef] __user * @@
   drivers/tty/vt/vt_ioctl.c:652:21: sparse:     expected unsigned short *__pu_addr
>> drivers/tty/vt/vt_ioctl.c:652:21: sparse:     got unsigned short [noderef] __user *
   drivers/tty/vt/vt_ioctl.c:662:31: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned short *__pu_addr @@     got unsigned short [noderef] __user * @@
   drivers/tty/vt/vt_ioctl.c:662:31: sparse:     expected unsigned short *__pu_addr
   drivers/tty/vt/vt_ioctl.c:662:31: sparse:     got unsigned short [noderef] __user *
>> drivers/tty/vt/vt_ioctl.c:839: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:839:21: sparse:     expected unsigned short const *__gu_addr
   drivers/tty/vt/vt_ioctl.c:839:21: sparse:     got unsigned short [noderef] __user *
   drivers/tty/vt/vt_ioctl.c:840: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:840:21: sparse:     expected unsigned short const *__gu_addr
   drivers/tty/vt/vt_ioctl.c:840:21: sparse:     got unsigned short [noderef] __user *
   drivers/tty/vt/vt_ioctl.c:1032:23: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned short *__pu_addr @@     got unsigned short [noderef] __user * @@
   drivers/tty/vt/vt_ioctl.c:1032:23: sparse:     expected unsigned short *__pu_addr
   drivers/tty/vt/vt_ioctl.c:1032:23: sparse:     got unsigned short [noderef] __user *
   drivers/tty/vt/vt_ioctl.c: note: in included file (through include/linux/sched/task.h, include/linux/sched/signal.h):
   include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *to @@     got void [noderef] __user *to @@
   include/linux/uaccess.h:131:38: sparse:     expected void *to
   include/linux/uaccess.h:131:38: sparse:     got void [noderef] __user *to
   include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got void const *from @@
   include/linux/uaccess.h:131:42: sparse:     expected void const [noderef] __user *from
   include/linux/uaccess.h:131:42: sparse:     got void const *from
   drivers/tty/vt/vt_ioctl.c: note: in included file (through include/linux/uaccess.h, include/linux/sched/task.h, include/linux/sched/signal.h):
   arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const *from @@     got void const [noderef] __user *from @@
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     expected void const *from
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     got void const [noderef] __user *from
   drivers/tty/vt/vt_ioctl.c: note: in included file (through include/linux/sched/task.h, include/linux/sched/signal.h):
   include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *to @@     got void [noderef] __user *to @@
   include/linux/uaccess.h:131:38: sparse:     expected void *to
   include/linux/uaccess.h:131:38: sparse:     got void [noderef] __user *to
   include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got void const *from @@
   include/linux/uaccess.h:131:42: sparse:     expected void const [noderef] __user *from
   include/linux/uaccess.h:131:42: sparse:     got void const *from
   drivers/tty/vt/vt_ioctl.c: note: in included file (through include/linux/uaccess.h, include/linux/sched/task.h, include/linux/sched/signal.h):
   arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const *from @@     got void const [noderef] __user *from @@
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     expected void const *from
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     got void const [noderef] __user *from
   drivers/tty/vt/vt_ioctl.c: note: in included file (through include/linux/sched/task.h, include/linux/sched/signal.h):
   include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *to @@     got void [noderef] __user *to @@
   include/linux/uaccess.h:131:38: sparse:     expected void *to
   include/linux/uaccess.h:131:38: sparse:     got void [noderef] __user *to
   include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got void const *from @@
   include/linux/uaccess.h:131:42: sparse:     expected void const [noderef] __user *from
   include/linux/uaccess.h:131:42: sparse:     got void const *from
   drivers/tty/vt/vt_ioctl.c: note: in included file (through include/linux/uaccess.h, include/linux/sched/task.h, include/linux/sched/signal.h):
   arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const *from @@     got void const [noderef] __user *from @@
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     expected void const *from
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     got void const [noderef] __user *from
   drivers/tty/vt/vt_ioctl.c: note: in included file (through include/linux/sched/task.h, include/linux/sched/signal.h):
   include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *to @@     got void [noderef] __user *to @@
   include/linux/uaccess.h:131:38: sparse:     expected void *to
   include/linux/uaccess.h:131:38: sparse:     got void [noderef] __user *to
   include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got void const *from @@
   include/linux/uaccess.h:131:42: sparse:     expected void const [noderef] __user *from
   include/linux/uaccess.h:131:42: sparse:     got void const *from
   drivers/tty/vt/vt_ioctl.c: note: in included file (through include/linux/uaccess.h, include/linux/sched/task.h, include/linux/sched/signal.h):
   arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const *from @@     got void const [noderef] __user *from @@
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     expected void const *from
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     got void const [noderef] __user *from
   drivers/tty/vt/vt_ioctl.c: note: in included file (through include/linux/sched/task.h, include/linux/sched/signal.h):
   include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *to @@     got void [noderef] __user *to @@
   include/linux/uaccess.h:131:38: sparse:     expected void *to
   include/linux/uaccess.h:131:38: sparse:     got void [noderef] __user *to
   include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got void const *from @@
   include/linux/uaccess.h:131:42: sparse:     expected void const [noderef] __user *from
   include/linux/uaccess.h:131:42: sparse:     got void const *from
   drivers/tty/vt/vt_ioctl.c: note: in included file (through include/linux/uaccess.h, include/linux/sched/task.h, include/linux/sched/signal.h):
   arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const *from @@     got void const [noderef] __user *from @@
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     expected void const *from
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     got void const [noderef] __user *from
--
>> drivers/tty/vt/keyboard.c:1684:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned int *__pu_addr @@     got unsigned int [noderef] __user * @@
   drivers/tty/vt/keyboard.c:1684:21: sparse:     expected unsigned int *__pu_addr
>> drivers/tty/vt/keyboard.c:1684:21: sparse:     got unsigned int [noderef] __user *
   drivers/tty/vt/keyboard.c:1711:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned int *__pu_addr @@     got unsigned int [noderef] __user * @@
   drivers/tty/vt/keyboard.c:1711:21: sparse:     expected unsigned int *__pu_addr
   drivers/tty/vt/keyboard.c:1711:21: sparse:     got unsigned int [noderef] __user *
>> drivers/tty/vt/keyboard.c:1729: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:1729:21: sparse:     expected unsigned int const *__gu_addr
   drivers/tty/vt/keyboard.c:1729:21: sparse:     got unsigned int [noderef] __user *
   drivers/tty/vt/keyboard.c:1767: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:1767:21: sparse:     expected unsigned int const *__gu_addr
   drivers/tty/vt/keyboard.c:1767:21: sparse:     got unsigned int [noderef] __user *
   drivers/tty/vt/keyboard.c:1873:30: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned int *__pu_addr @@     got unsigned int [noderef] __user * @@
   drivers/tty/vt/keyboard.c:1873:30: sparse:     expected unsigned int *__pu_addr
   drivers/tty/vt/keyboard.c:1873:30: sparse:     got unsigned int [noderef] __user *
>> drivers/tty/vt/keyboard.c:1914:24: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned short *__pu_addr @@     got unsigned short [noderef] __user * @@
   drivers/tty/vt/keyboard.c:1914:24: sparse:     expected unsigned short *__pu_addr
>> drivers/tty/vt/keyboard.c:1914:24: sparse:     got unsigned short [noderef] __user *
>> drivers/tty/vt/keyboard.c:2032:37: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned char *__pu_addr @@     got unsigned char [noderef] [usertype] __user * @@
   drivers/tty/vt/keyboard.c:2032:37: sparse:     expected unsigned char *__pu_addr
>> drivers/tty/vt/keyboard.c:2032:37: sparse:     got unsigned char [noderef] [usertype] __user *
>> drivers/tty/vt/keyboard.c:2036:21: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned char *__pu_addr @@     got unsigned char [noderef] [usertype] __user *[assigned] up @@
   drivers/tty/vt/keyboard.c:2036:21: sparse:     expected unsigned char *__pu_addr
>> drivers/tty/vt/keyboard.c:2036:21: sparse:     got unsigned char [noderef] [usertype] __user *[assigned] up
>> drivers/tty/vt/keyboard.c:2139:24: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected char *__pu_addr @@     got char [noderef] __user * @@
   drivers/tty/vt/keyboard.c:2139:24: sparse:     expected char *__pu_addr
>> drivers/tty/vt/keyboard.c:2139:24: sparse:     got char [noderef] __user *
   drivers/tty/vt/keyboard.c:2157:24: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected char *__pu_addr @@     got char [noderef] __user * @@
   drivers/tty/vt/keyboard.c:2157:24: sparse:     expected char *__pu_addr
   drivers/tty/vt/keyboard.c:2157:24: sparse:     got char [noderef] __user *
   drivers/tty/vt/keyboard.c: note: in included file (through include/linux/sched/task.h, include/linux/sched/signal.h):
   include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *to @@     got void [noderef] __user *to @@
   include/linux/uaccess.h:131:38: sparse:     expected void *to
   include/linux/uaccess.h:131:38: sparse:     got void [noderef] __user *to
   include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got void const *from @@
   include/linux/uaccess.h:131:42: sparse:     expected void const [noderef] __user *from
   include/linux/uaccess.h:131:42: sparse:     got void const *from
   drivers/tty/vt/keyboard.c: note: in included file (through include/linux/uaccess.h, include/linux/sched/task.h, include/linux/sched/signal.h):
   arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const *from @@     got void const [noderef] __user *from @@
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     expected void const *from
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     got void const [noderef] __user *from
   drivers/tty/vt/keyboard.c: note: in included file (through include/linux/sched/task.h, include/linux/sched/signal.h):
   include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *to @@     got void [noderef] __user *to @@
   include/linux/uaccess.h:131:38: sparse:     expected void *to
   include/linux/uaccess.h:131:38: sparse:     got void [noderef] __user *to
   include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got void const *from @@
   include/linux/uaccess.h:131:42: sparse:     expected void const [noderef] __user *from
   include/linux/uaccess.h:131:42: sparse:     got void const *from
   drivers/tty/vt/keyboard.c: note: in included file (through include/linux/uaccess.h, include/linux/sched/task.h, include/linux/sched/signal.h):
   arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const *from @@     got void const [noderef] __user *from @@
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     expected void const *from
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     got void const [noderef] __user *from
--
>> drivers/tty/vt/consolemap.c:777:9: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned short *__pu_addr @@     got unsigned short [noderef] [usertype] __user *uct @@
   drivers/tty/vt/consolemap.c:777:9: sparse:     expected unsigned short *__pu_addr
>> drivers/tty/vt/consolemap.c:777:9: sparse:     got unsigned short [noderef] [usertype] __user *uct
   drivers/tty/vt/consolemap.c: note: in included file (through include/linux/sched/task.h, include/linux/sched/signal.h, include/linux/rcuwait.h, ...):
   include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *to @@     got void [noderef] __user *to @@
   include/linux/uaccess.h:131:38: sparse:     expected void *to
   include/linux/uaccess.h:131:38: sparse:     got void [noderef] __user *to
   include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got void const *from @@
   include/linux/uaccess.h:131:42: sparse:     expected void const [noderef] __user *from
   include/linux/uaccess.h:131:42: sparse:     got void const *from
   drivers/tty/vt/consolemap.c: note: in included file (through include/linux/uaccess.h, include/linux/sched/task.h, include/linux/sched/signal.h, ...):
   arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const *from @@     got void const [noderef] __user *from @@
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     expected void const *from
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     got void const [noderef] __user *from
   drivers/tty/vt/consolemap.c: note: in included file (through include/linux/sched/task.h, include/linux/sched/signal.h, include/linux/rcuwait.h, ...):
   include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *to @@     got void [noderef] __user *to @@
   include/linux/uaccess.h:131:38: sparse:     expected void *to
   include/linux/uaccess.h:131:38: sparse:     got void [noderef] __user *to
   include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got void const *from @@
   include/linux/uaccess.h:131:42: sparse:     expected void const [noderef] __user *from
   include/linux/uaccess.h:131:42: sparse:     got void const *from
   drivers/tty/vt/consolemap.c: note: in included file (through include/linux/uaccess.h, include/linux/sched/task.h, include/linux/sched/signal.h, ...):
   arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const *from @@     got void const [noderef] __user *from @@
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     expected void const *from
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     got void const [noderef] __user *from
   drivers/tty/vt/consolemap.c: note: in included file (through include/linux/sched/task.h, include/linux/sched/signal.h, include/linux/rcuwait.h, ...):
   include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *to @@     got void [noderef] __user *to @@
   include/linux/uaccess.h:131:38: sparse:     expected void *to
   include/linux/uaccess.h:131:38: sparse:     got void [noderef] __user *to
   include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got void const *from @@
   include/linux/uaccess.h:131:42: sparse:     expected void const [noderef] __user *from
   include/linux/uaccess.h:131:42: sparse:     got void const *from
   drivers/tty/vt/consolemap.c: note: in included file (through include/linux/uaccess.h, include/linux/sched/task.h, include/linux/sched/signal.h, ...):
   arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const *from @@     got void const [noderef] __user *from @@
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     expected void const *from
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     got void const [noderef] __user *from
--
>> drivers/tty/vt/vt.c:4210:13: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected char const *__gu_addr @@     got char [noderef] __user * @@
   drivers/tty/vt/vt.c:4210:13: sparse:     expected char const *__gu_addr
>> drivers/tty/vt/vt.c:4210:13: sparse:     got char [noderef] __user *
   drivers/tty/vt/vt.c:233:5: sparse: sparse: symbol 'console_blank_hook' was not declared. Should it be static?
   drivers/tty/vt/vt.c:2901:19: sparse: sparse: symbol 'console_driver' was not declared. Should it be static?
>> drivers/tty/vt/vt.c:3057: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:3057:13: sparse:     expected char const *__gu_addr
>> drivers/tty/vt/vt.c:3057:13: sparse:     got char [noderef] __user *p
>> drivers/tty/vt/vt.c:3089:31: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected char *__pu_addr @@     got char [noderef] __user *p @@
   drivers/tty/vt/vt.c:3089:31: sparse:     expected char *__pu_addr
   drivers/tty/vt/vt.c:3089:31: sparse:     got char [noderef] __user *p
   drivers/tty/vt/vt.c:3095:31: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected char *__pu_addr @@     got char [noderef] __user *p @@
   drivers/tty/vt/vt.c:3095:31: sparse:     expected char *__pu_addr
   drivers/tty/vt/vt.c:3095:31: sparse:     got char [noderef] __user *p
   drivers/tty/vt/vt.c:3104:31: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected char *__pu_addr @@     got char [noderef] __user *p @@
   drivers/tty/vt/vt.c:3104:31: sparse:     expected char *__pu_addr
   drivers/tty/vt/vt.c:3104:31: sparse:     got char [noderef] __user *p
   drivers/tty/vt/vt.c:3110:37: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected char const *__gu_addr @@     got char [noderef] __user * @@
   drivers/tty/vt/vt.c:3110:37: sparse:     expected char const *__gu_addr
   drivers/tty/vt/vt.c:3110:37: sparse:     got char [noderef] __user *
>> drivers/tty/vt/vt.c:3123: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:3123:29: sparse:     expected signed int const *__gu_addr
>> drivers/tty/vt/vt.c:3123:29: sparse:     got signed int [noderef] [usertype] __user *
   drivers/tty/vt/vt.c: note: in included file (through include/asm-generic/atomic.h, arch/openrisc/include/asm/atomic.h, include/linux/atomic.h, ...):
   arch/openrisc/include/asm/cmpxchg.h:101:29: sparse: sparse: shift too big (32) for type int
   arch/openrisc/include/asm/cmpxchg.h:69:29: sparse: sparse: shift too big (32) for type int
   drivers/tty/vt/vt.c: note: in included file (through include/linux/sched/task.h, include/linux/sched/signal.h):
   include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *to @@     got void [noderef] __user *to @@
   include/linux/uaccess.h:131:38: sparse:     expected void *to
   include/linux/uaccess.h:131:38: sparse:     got void [noderef] __user *to
   include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got void const *from @@
   include/linux/uaccess.h:131:42: sparse:     expected void const [noderef] __user *from
   include/linux/uaccess.h:131:42: sparse:     got void const *from
   drivers/tty/vt/vt.c: note: in included file (through include/linux/uaccess.h, include/linux/sched/task.h, include/linux/sched/signal.h):
   arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const *from @@     got void const [noderef] __user *from @@
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     expected void const *from
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     got void const [noderef] __user *from
   drivers/tty/vt/vt.c: note: in included file (through include/linux/sched/task.h, include/linux/sched/signal.h):
   include/linux/uaccess.h:131:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *to @@     got void [noderef] __user *to @@
   include/linux/uaccess.h:131:38: sparse:     expected void *to
   include/linux/uaccess.h:131:38: sparse:     got void [noderef] __user *to
   include/linux/uaccess.h:131:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const [noderef] __user *from @@     got void const *from @@
   include/linux/uaccess.h:131:42: sparse:     expected void const [noderef] __user *from
   include/linux/uaccess.h:131:42: sparse:     got void const *from
   drivers/tty/vt/vt.c: note: in included file (through include/linux/uaccess.h, include/linux/sched/task.h, include/linux/sched/signal.h):
   arch/openrisc/include/asm/uaccess.h:246:55: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const *from @@     got void const [noderef] __user *from @@
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     expected void const *from
   arch/openrisc/include/asm/uaccess.h:246:55: sparse:     got void const [noderef] __user *from

vim +411 drivers/tty/vt/vt_ioctl.c

8b92e87d39bfd0 drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  344  
8b92e87d39bfd0 drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  345  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  346  /*
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  347   * We handle the console-specific ioctl's here.  We allow the
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  348   * capability to modify any console, not just the fg_console. 
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  349   */
6caa76b7786891 drivers/tty/vt/vt_ioctl.c Alan Cox            2011-02-14  350  int vt_ioctl(struct tty_struct *tty,
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  351  	     unsigned int cmd, unsigned long arg)
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  352  {
c9f19e96a2f33c drivers/char/vt_ioctl.c   Alan Cox            2009-01-02  353  	struct vc_data *vc = tty->driver_data;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  354  	struct console_font_op op;	/* used in multiple places here */
1aa6e058dd6cd0 drivers/tty/vt/vt_ioctl.c Eric Biggers        2020-02-24  355  	unsigned int console = vc->vc_num;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  356  	unsigned char ucval;
1e0ad2881d50be drivers/char/vt_ioctl.c   Graham Gower        2010-10-27  357  	unsigned int uival;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  358  	void __user *up = (void __user *)arg;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  359  	int i, perm;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  360  	int ret = 0;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  361  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  362  	/*
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  363  	 * To have permissions to do most of the vt ioctls, we either have
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  364  	 * to be the owner of the tty, or have CAP_SYS_TTY_CONFIG.
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  365  	 */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  366  	perm = 0;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  367  	if (current->signal->tty == tty || capable(CAP_SYS_TTY_CONFIG))
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  368  		perm = 1;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  369   
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  370  	switch (cmd) {
e6885107736a4d drivers/char/vt_ioctl.c   Alan Cox            2008-10-13  371  	case TIOCLINUX:
a115902f67ef51 drivers/char/vt_ioctl.c   Jiri Slaby          2009-06-22  372  		ret = tioclinux(tty, arg);
a115902f67ef51 drivers/char/vt_ioctl.c   Jiri Slaby          2009-06-22  373  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  374  	case KIOCSOUND:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  375  		if (!perm)
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-03-02  376  			return -EPERM;
2c4e9671edfef5 drivers/char/vt_ioctl.c   Arnd Bergmann       2010-08-28  377  		/*
2c4e9671edfef5 drivers/char/vt_ioctl.c   Arnd Bergmann       2010-08-28  378  		 * The use of PIT_TICK_RATE is historic, it used to be
2c4e9671edfef5 drivers/char/vt_ioctl.c   Arnd Bergmann       2010-08-28  379  		 * the platform-dependent CLOCK_TICK_RATE between 2.6.12
2c4e9671edfef5 drivers/char/vt_ioctl.c   Arnd Bergmann       2010-08-28  380  		 * and 2.6.36, which was a minor but unfortunate ABI
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-03-02  381  		 * change. kd_mksound is locked by the input layer.
2c4e9671edfef5 drivers/char/vt_ioctl.c   Arnd Bergmann       2010-08-28  382  		 */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  383  		if (arg)
2c4e9671edfef5 drivers/char/vt_ioctl.c   Arnd Bergmann       2010-08-28  384  			arg = PIT_TICK_RATE / arg;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  385  		kd_mksound(arg, 0);
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  386  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  387  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  388  	case KDMKTONE:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  389  		if (!perm)
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-03-02  390  			return -EPERM;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  391  	{
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  392  		unsigned int ticks, count;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  393  		
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  394  		/*
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  395  		 * Generate the tone for the appropriate number of ticks.
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  396  		 * If the time is zero, turn off sound ourselves.
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  397  		 */
4c0d9b17d1c060 drivers/tty/vt/vt_ioctl.c Nicholas Mc Guire   2015-02-09  398  		ticks = msecs_to_jiffies((arg >> 16) & 0xffff);
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  399  		count = ticks ? (arg & 0xffff) : 0;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  400  		if (count)
2c4e9671edfef5 drivers/char/vt_ioctl.c   Arnd Bergmann       2010-08-28  401  			count = PIT_TICK_RATE / count;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  402  		kd_mksound(count, ticks);
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  403  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  404  	}
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  405  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  406  	case KDGKBTYPE:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  407  		/*
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-03-02  408  		 * this is naïve.
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  409  		 */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  410  		ucval = KB_101;
079c9534a96da9 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-02-28 @411  		ret = put_user(ucval, (char __user *)arg);
079c9534a96da9 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-02-28  412  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  413  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  414  		/*
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  415  		 * These cannot be implemented on any machine that implements
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  416  		 * ioperm() in user level (such as Alpha PCs) or not at all.
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  417  		 *
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  418  		 * XXX: you should never use these, just call ioperm directly..
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  419  		 */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  420  #ifdef CONFIG_X86
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  421  	case KDADDIO:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  422  	case KDDELIO:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  423  		/*
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  424  		 * KDADDIO and KDDELIO may be able to add ports beyond what
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  425  		 * we reject here, but to be safe...
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-03-02  426  		 *
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-03-02  427  		 * These are locked internally via sys_ioperm
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  428  		 */
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  429  		if (arg < GPFIRST || arg > GPLAST) {
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  430  			ret = -EINVAL;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  431  			break;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  432  		}
66f4e88cc69da7 drivers/tty/vt/vt_ioctl.c Dominik Brodowski   2018-03-11  433  		ret = ksys_ioperm(arg, 1, (cmd == KDADDIO)) ? -ENXIO : 0;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  434  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  435  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  436  	case KDENABIO:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  437  	case KDDISABIO:
66f4e88cc69da7 drivers/tty/vt/vt_ioctl.c Dominik Brodowski   2018-03-11  438  		ret = ksys_ioperm(GPFIRST, GPNUM,
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  439  				  (cmd == KDENABIO)) ? -ENXIO : 0;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  440  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  441  #endif
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  442  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  443  	/* Linux m68k/i386 interface for setting the keyboard delay/repeat rate */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  444  		
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  445  	case KDKBDREP:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  446  	{
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  447  		struct kbd_repeat kbrep;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  448  		
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  449  		if (!capable(CAP_SYS_TTY_CONFIG))
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-03-02  450  			return -EPERM;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  451  
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  452  		if (copy_from_user(&kbrep, up, sizeof(struct kbd_repeat))) {
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  453  			ret =  -EFAULT;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  454  			break;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  455  		}
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  456  		ret = kbd_rate(&kbrep);
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  457  		if (ret)
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  458  			break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  459  		if (copy_to_user(up, &kbrep, sizeof(struct kbd_repeat)))
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  460  			ret = -EFAULT;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  461  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  462  	}
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  463  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  464  	case KDSETMODE:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  465  		/*
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  466  		 * currently, setting the mode from KD_TEXT to KD_GRAPHICS
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  467  		 * doesn't do a whole lot. i'm not sure if it should do any
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  468  		 * restoration of modes or what...
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  469  		 *
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  470  		 * XXX It should at least call into the driver, fbdev's definitely
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  471  		 * need to restore their engine state. --BenH
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  472  		 */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  473  		if (!perm)
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-03-02  474  			return -EPERM;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  475  		switch (arg) {
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  476  		case KD_GRAPHICS:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  477  			break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  478  		case KD_TEXT0:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  479  		case KD_TEXT1:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  480  			arg = KD_TEXT;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  481  		case KD_TEXT:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  482  			break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  483  		default:
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  484  			ret = -EINVAL;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  485  			goto out;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  486  		}
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-03-02  487  		/* FIXME: this needs the console lock extending */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  488  		if (vc->vc_mode == (unsigned char) arg)
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  489  			break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  490  		vc->vc_mode = (unsigned char) arg;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  491  		if (console != fg_console)
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  492  			break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  493  		/*
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  494  		 * explicitly blank/unblank the screen if switching modes
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  495  		 */
ac751efa6a0d70 drivers/tty/vt/vt_ioctl.c Torben Hohn         2011-01-25  496  		console_lock();
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  497  		if (arg == KD_TEXT)
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  498  			do_unblank_screen(1);
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  499  		else
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  500  			do_blank_screen(1);
ac751efa6a0d70 drivers/tty/vt/vt_ioctl.c Torben Hohn         2011-01-25  501  		console_unlock();
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  502  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  503  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  504  	case KDGETMODE:
1e0ad2881d50be drivers/char/vt_ioctl.c   Graham Gower        2010-10-27  505  		uival = vc->vc_mode;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  506  		goto setint;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  507  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  508  	case KDMAPDISP:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  509  	case KDUNMAPDISP:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  510  		/*
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  511  		 * these work like a combination of mmap and KDENABIO.
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  512  		 * this could be easily finished.
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  513  		 */
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  514  		ret = -EINVAL;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  515  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  516  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  517  	case KDSKBMODE:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  518  		if (!perm)
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-03-02  519  			return -EPERM;
079c9534a96da9 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-02-28  520  		ret = vt_do_kdskbmode(console, arg);
079c9534a96da9 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-02-28  521  		if (ret == 0)
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  522  			tty_ldisc_flush(tty);
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  523  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  524  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  525  	case KDGKBMODE:
079c9534a96da9 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-02-28  526  		uival = vt_do_kdgkbmode(console);
079c9534a96da9 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-02-28 @527  		ret = put_user(uival, (int __user *)arg);
6da9e95f7381fa drivers/tty/vt/vt_ioctl.c Andrew Morton       2011-04-07  528  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  529  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  530  	/* this could be folded into KDSKBMODE, but for compatibility
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  531  	   reasons it is not so easy to fold KDGKBMETA into KDGKBMODE */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  532  	case KDSKBMETA:
079c9534a96da9 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-02-28  533  		ret = vt_do_kdskbmeta(console, arg);
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  534  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  535  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  536  	case KDGKBMETA:
079c9534a96da9 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-02-28  537  		/* FIXME: should review whether this is worth locking */
079c9534a96da9 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-02-28  538  		uival = vt_do_kdgkbmeta(console);
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  539  	setint:
1e0ad2881d50be drivers/char/vt_ioctl.c   Graham Gower        2010-10-27  540  		ret = put_user(uival, (int __user *)arg);
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  541  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  542  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  543  	case KDGETKEYCODE:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  544  	case KDSETKEYCODE:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  545  		if(!capable(CAP_SYS_TTY_CONFIG))
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  546  			perm = 0;
079c9534a96da9 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-02-28  547  		ret = vt_do_kbkeycode_ioctl(cmd, up, perm);
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  548  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  549  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  550  	case KDGKBENT:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  551  	case KDSKBENT:
079c9534a96da9 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-02-28  552  		ret = vt_do_kdsk_ioctl(cmd, up, perm, console);
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  553  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  554  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  555  	case KDGKBSENT:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  556  	case KDSKBSENT:
079c9534a96da9 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-02-28  557  		ret = vt_do_kdgkb_ioctl(cmd, up, perm);
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  558  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  559  
247ff8e610cb63 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-02-24  560  	/* Diacritical processing. Handled in keyboard.c as it has
247ff8e610cb63 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-02-24  561  	   to operate on the keyboard locks and structures */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  562  	case KDGKBDIACR:
04c71976500352 drivers/char/vt_ioctl.c   Samuel Thibault     2007-10-16  563  	case KDGKBDIACRUC:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  564  	case KDSKBDIACR:
04c71976500352 drivers/char/vt_ioctl.c   Samuel Thibault     2007-10-16  565  	case KDSKBDIACRUC:
247ff8e610cb63 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-02-24  566  		ret = vt_do_diacrit(cmd, up, perm);
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  567  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  568  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  569  	/* the ioctls below read/set the flags usually shown in the leds */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  570  	/* don't use them - they will go away without warning */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  571  	case KDGKBLED:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  572  	case KDSKBLED:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  573  	case KDGETLED:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  574  	case KDSETLED:
079c9534a96da9 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-02-28  575  		ret = vt_do_kdskled(console, cmd, arg, perm);
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  576  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  577  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  578  	/*
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  579  	 * A process can indicate its willingness to accept signals
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  580  	 * generated by pressing an appropriate key combination.
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  581  	 * Thus, one can have a daemon that e.g. spawns a new console
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  582  	 * upon a keypress and then changes to it.
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  583  	 * See also the kbrequest field of inittab(5).
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  584  	 */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  585  	case KDSIGACCEPT:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  586  	{
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  587  		if (!perm || !capable(CAP_KILL))
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-03-02  588  			return -EPERM;
7ed20e1ad521b5 drivers/char/vt_ioctl.c   Jesper Juhl         2005-05-01  589  		if (!valid_signal(arg) || arg < 1 || arg == SIGKILL)
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  590  			ret = -EINVAL;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  591  		else {
81af8d67d4fc35 drivers/char/vt_ioctl.c   Eric W. Biederman   2006-10-02  592  			spin_lock_irq(&vt_spawn_con.lock);
81af8d67d4fc35 drivers/char/vt_ioctl.c   Eric W. Biederman   2006-10-02  593  			put_pid(vt_spawn_con.pid);
81af8d67d4fc35 drivers/char/vt_ioctl.c   Eric W. Biederman   2006-10-02  594  			vt_spawn_con.pid = get_pid(task_pid(current));
81af8d67d4fc35 drivers/char/vt_ioctl.c   Eric W. Biederman   2006-10-02  595  			vt_spawn_con.sig = arg;
81af8d67d4fc35 drivers/char/vt_ioctl.c   Eric W. Biederman   2006-10-02  596  			spin_unlock_irq(&vt_spawn_con.lock);
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  597  		}
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  598  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  599  	}
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  600  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  601  	case VT_SETMODE:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  602  	{
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  603  		struct vt_mode tmp;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  604  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  605  		if (!perm)
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-03-02  606  			return -EPERM;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  607  		if (copy_from_user(&tmp, up, sizeof(struct vt_mode))) {
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  608  			ret = -EFAULT;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  609  			goto out;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  610  		}
87a6aca504d65f drivers/char/vt_ioctl.c   Greg Kroah-Hartman  2010-03-15  611  		if (tmp.mode != VT_AUTO && tmp.mode != VT_PROCESS) {
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  612  			ret = -EINVAL;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  613  			goto out;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  614  		}
ac751efa6a0d70 drivers/tty/vt/vt_ioctl.c Torben Hohn         2011-01-25  615  		console_lock();
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  616  		vc->vt_mode = tmp;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  617  		/* the frsig is ignored, so we set it to 0 */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  618  		vc->vt_mode.frsig = 0;
8b6312f4dcc1ef drivers/char/vt_ioctl.c   Eric W. Biederman   2007-02-10  619  		put_pid(vc->vt_pid);
8b6312f4dcc1ef drivers/char/vt_ioctl.c   Eric W. Biederman   2007-02-10  620  		vc->vt_pid = get_pid(task_pid(current));
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  621  		/* no switch is required -- saw@...de.msu.ru */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  622  		vc->vt_newvt = -1;
ac751efa6a0d70 drivers/tty/vt/vt_ioctl.c Torben Hohn         2011-01-25  623  		console_unlock();
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  624  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  625  	}
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  626  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  627  	case VT_GETMODE:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  628  	{
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  629  		struct vt_mode tmp;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  630  		int rc;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  631  
ac751efa6a0d70 drivers/tty/vt/vt_ioctl.c Torben Hohn         2011-01-25  632  		console_lock();
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  633  		memcpy(&tmp, &vc->vt_mode, sizeof(struct vt_mode));
ac751efa6a0d70 drivers/tty/vt/vt_ioctl.c Torben Hohn         2011-01-25  634  		console_unlock();
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  635  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  636  		rc = copy_to_user(up, &tmp, sizeof(struct vt_mode));
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  637  		if (rc)
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  638  			ret = -EFAULT;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  639  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  640  	}
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  641  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  642  	/*
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  643  	 * Returns global vt state. Note that VT 0 is always open, since
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  644  	 * 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  645  	 * 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  646  	 */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  647  	case VT_GETSTATE:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  648  	{
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  649  		struct vt_stat __user *vtstat = up;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  650  		unsigned short state, mask;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  651  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  652  		if (put_user(fg_console + 1, &vtstat->v_active))
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  653  			ret = -EFAULT;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  654  		else {
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  655  			state = 1;	/* /dev/tty0 is always open */
7cf64b18b0b96e drivers/tty/vt/vt_ioctl.c Eric Biggers        2020-03-21  656  			console_lock(); /* required by vt_in_use() */
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  657  			for (i = 0, mask = 2; i < MAX_NR_CONSOLES && mask;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  658  							++i, mask <<= 1)
e587e8f17433dd drivers/tty/vt/vt_ioctl.c Jiri Slaby          2020-02-19  659  				if (vt_in_use(i))
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  660  					state |= mask;
7cf64b18b0b96e drivers/tty/vt/vt_ioctl.c Eric Biggers        2020-03-21  661  			console_unlock();
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  662  			ret = put_user(state, &vtstat->v_state);
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  663  		}
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  664  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  665  	}
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  666  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  667  	/*
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  668  	 * Returns the first available (non-opened) console.
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  669  	 */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  670  	case VT_OPENQRY:
7cf64b18b0b96e drivers/tty/vt/vt_ioctl.c Eric Biggers        2020-03-21  671  		console_lock(); /* required by vt_in_use() */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  672  		for (i = 0; i < MAX_NR_CONSOLES; ++i)
e587e8f17433dd drivers/tty/vt/vt_ioctl.c Jiri Slaby          2020-02-19  673  			if (!vt_in_use(i))
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  674  				break;
7cf64b18b0b96e drivers/tty/vt/vt_ioctl.c Eric Biggers        2020-03-21  675  		console_unlock();
1e0ad2881d50be drivers/char/vt_ioctl.c   Graham Gower        2010-10-27  676  		uival = i < MAX_NR_CONSOLES ? (i+1) : -1;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  677  		goto setint;		 
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  678  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  679  	/*
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  680  	 * ioctl(fd, VT_ACTIVATE, num) will cause us to switch to vt # num,
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  681  	 * with num >= 1 (switches to vt 0, our console, are not allowed, just
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  682  	 * to preserve sanity).
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  683  	 */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  684  	case VT_ACTIVATE:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  685  		if (!perm)
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-03-02  686  			return -EPERM;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  687  		if (arg == 0 || arg > MAX_NR_CONSOLES)
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  688  			ret =  -ENXIO;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  689  		else {
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  690  			arg--;
ac751efa6a0d70 drivers/tty/vt/vt_ioctl.c Torben Hohn         2011-01-25  691  			console_lock();
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  692  			ret = vc_allocate(arg);
ac751efa6a0d70 drivers/tty/vt/vt_ioctl.c Torben Hohn         2011-01-25  693  			console_unlock();
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  694  			if (ret)
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  695  				break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  696  			set_console(arg);
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  697  		}
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  698  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  699  
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  700  	case VT_SETACTIVATE:
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  701  	{
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  702  		struct vt_setactivate vsa;
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  703  
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  704  		if (!perm)
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-03-02  705  			return -EPERM;
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  706  
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  707  		if (copy_from_user(&vsa, (struct vt_setactivate __user *)arg,
a09efb07b5025f drivers/char/vt_ioctl.c   Jiri Slaby          2009-10-01  708  					sizeof(struct vt_setactivate))) {
a09efb07b5025f drivers/char/vt_ioctl.c   Jiri Slaby          2009-10-01  709  			ret = -EFAULT;
a09efb07b5025f drivers/char/vt_ioctl.c   Jiri Slaby          2009-10-01  710  			goto out;
a09efb07b5025f drivers/char/vt_ioctl.c   Jiri Slaby          2009-10-01  711  		}
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  712  		if (vsa.console == 0 || vsa.console > MAX_NR_CONSOLES)
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  713  			ret = -ENXIO;
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  714  		else {
e97267cb4d1ee0 drivers/tty/vt/vt_ioctl.c Gustavo A. R. Silva 2018-08-16  715  			vsa.console = array_index_nospec(vsa.console,
e97267cb4d1ee0 drivers/tty/vt/vt_ioctl.c Gustavo A. R. Silva 2018-08-16  716  							 MAX_NR_CONSOLES + 1);
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  717  			vsa.console--;
ac751efa6a0d70 drivers/tty/vt/vt_ioctl.c Torben Hohn         2011-01-25  718  			console_lock();
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  719  			ret = vc_allocate(vsa.console);
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  720  			if (ret == 0) {
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  721  				struct vc_data *nvc;
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  722  				/* This is safe providing we don't drop the
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  723  				   console sem between vc_allocate and
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  724  				   finishing referencing nvc */
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  725  				nvc = vc_cons[vsa.console].d;
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  726  				nvc->vt_mode = vsa.mode;
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  727  				nvc->vt_mode.frsig = 0;
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  728  				put_pid(nvc->vt_pid);
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  729  				nvc->vt_pid = get_pid(task_pid(current));
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  730  			}
ac751efa6a0d70 drivers/tty/vt/vt_ioctl.c Torben Hohn         2011-01-25  731  			console_unlock();
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  732  			if (ret)
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  733  				break;
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  734  			/* Commence switch and lock */
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-03-02  735  			/* Review set_console locks */
d637837583163a drivers/tty/vt/vt_ioctl.c Jiri Olsa           2011-02-11  736  			set_console(vsa.console);
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  737  		}
d637837583163a drivers/tty/vt/vt_ioctl.c Jiri Olsa           2011-02-11  738  		break;
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  739  	}
d3b5cffcf84a8b drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  740  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  741  	/*
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  742  	 * wait until the specified VT has been activated
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  743  	 */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  744  	case VT_WAITACTIVE:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  745  		if (!perm)
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-03-02  746  			return -EPERM;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  747  		if (arg == 0 || arg > MAX_NR_CONSOLES)
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  748  			ret = -ENXIO;
99cceb4e50cb67 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-03-02  749  		else
8b92e87d39bfd0 drivers/char/vt_ioctl.c   Alan Cox            2009-09-19  750  			ret = vt_waitactive(arg);
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  751  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  752  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  753  	/*
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  754  	 * 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  755  	 * immediately, but postpone the operation until the process calls this
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  756  	 * ioctl, allowing the switch to complete.
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  757  	 *
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  758  	 * According to the X sources this is the behavior:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  759  	 *	0:	pending switch-from not OK
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  760  	 *	1:	pending switch-from OK
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  761  	 *	2:	completed switch-to OK
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  762  	 */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  763  	case VT_RELDISP:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  764  		if (!perm)
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-03-02  765  			return -EPERM;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  766  
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-03-02  767  		console_lock();
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  768  		if (vc->vt_mode.mode != VT_PROCESS) {
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-03-02  769  			console_unlock();
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  770  			ret = -EINVAL;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  771  			break;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  772  		}
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  773  		/*
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  774  		 * Switching-from response
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  775  		 */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  776  		if (vc->vt_newvt >= 0) {
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  777  			if (arg == 0)
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  778  				/*
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  779  				 * Switch disallowed, so forget we were trying
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  780  				 * to do it.
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  781  				 */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  782  				vc->vt_newvt = -1;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  783  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  784  			else {
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  785  				/*
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  786  				 * The current vt has been released, so
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  787  				 * complete the switch.
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  788  				 */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  789  				int newvt;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  790  				newvt = vc->vt_newvt;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  791  				vc->vt_newvt = -1;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  792  				ret = vc_allocate(newvt);
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  793  				if (ret) {
ac751efa6a0d70 drivers/tty/vt/vt_ioctl.c Torben Hohn         2011-01-25  794  					console_unlock();
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  795  					break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  796  				}
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  797  				/*
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  798  				 * When we actually do the console switch,
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  799  				 * make sure we are atomic with respect to
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  800  				 * other console switches..
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  801  				 */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  802  				complete_change_console(vc_cons[newvt].d);
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  803  			}
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  804  		} else {
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  805  			/*
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  806  			 * Switched-to response
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  807  			 */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  808  			/*
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  809  			 * If it's just an ACK, ignore it
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  810  			 */
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  811  			if (arg != VT_ACKACQ)
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  812  				ret = -EINVAL;
8792f961ba8057 drivers/char/vt_ioctl.c   Samuel Ortiz        2007-10-01  813  		}
ac751efa6a0d70 drivers/tty/vt/vt_ioctl.c Torben Hohn         2011-01-25  814  		console_unlock();
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  815  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  816  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  817  	 /*
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  818  	  * Disallocate memory associated to VT (but leave VT1)
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  819  	  */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  820  	 case VT_DISALLOCATE:
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  821  		if (arg > MAX_NR_CONSOLES) {
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  822  			ret = -ENXIO;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  823  			break;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  824  		}
421b40a6286ee3 drivers/tty/vt/vt_ioctl.c Peter Hurley        2013-05-17  825  		if (arg == 0)
421b40a6286ee3 drivers/tty/vt/vt_ioctl.c Peter Hurley        2013-05-17  826  			vt_disallocate_all();
421b40a6286ee3 drivers/tty/vt/vt_ioctl.c Peter Hurley        2013-05-17  827  		else
421b40a6286ee3 drivers/tty/vt/vt_ioctl.c Peter Hurley        2013-05-17  828  			ret = vt_disallocate(--arg);
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  829  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  830  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  831  	case VT_RESIZE:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  832  	{
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  833  		struct vt_sizes __user *vtsizes = up;
e400b6ec4ede4d drivers/char/vt_ioctl.c   Antonino A. Daplas  2007-10-16  834  		struct vc_data *vc;
e400b6ec4ede4d drivers/char/vt_ioctl.c   Antonino A. Daplas  2007-10-16  835  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  836  		ushort ll,cc;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  837  		if (!perm)
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-03-02  838  			return -EPERM;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  839  		if (get_user(ll, &vtsizes->v_rows) ||
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  840  		    get_user(cc, &vtsizes->v_cols))
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  841  			ret = -EFAULT;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  842  		else {
ac751efa6a0d70 drivers/tty/vt/vt_ioctl.c Torben Hohn         2011-01-25  843  			console_lock();
e400b6ec4ede4d drivers/char/vt_ioctl.c   Antonino A. Daplas  2007-10-16  844  			for (i = 0; i < MAX_NR_CONSOLES; i++) {
e400b6ec4ede4d drivers/char/vt_ioctl.c   Antonino A. Daplas  2007-10-16  845  				vc = vc_cons[i].d;
e400b6ec4ede4d drivers/char/vt_ioctl.c   Antonino A. Daplas  2007-10-16  846  
e400b6ec4ede4d drivers/char/vt_ioctl.c   Antonino A. Daplas  2007-10-16  847  				if (vc) {
e400b6ec4ede4d drivers/char/vt_ioctl.c   Antonino A. Daplas  2007-10-16  848  					vc->vc_resize_user = 1;
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-03-02  849  					/* FIXME: review v tty lock */
8c9a9dd0fa3a26 drivers/char/vt_ioctl.c   Alan Cox            2008-08-15  850  					vc_resize(vc_cons[i].d, cc, ll);
e400b6ec4ede4d drivers/char/vt_ioctl.c   Antonino A. Daplas  2007-10-16  851  				}
e400b6ec4ede4d drivers/char/vt_ioctl.c   Antonino A. Daplas  2007-10-16  852  			}
ac751efa6a0d70 drivers/tty/vt/vt_ioctl.c Torben Hohn         2011-01-25  853  			console_unlock();
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  854  		}
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  855  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  856  	}
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  857  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  858  	case VT_RESIZEX:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  859  	{
1b3bce4d6bf839 drivers/tty/vt/vt_ioctl.c Al Viro             2017-09-29  860  		struct vt_consize v;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  861  		if (!perm)
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-03-02  862  			return -EPERM;
1b3bce4d6bf839 drivers/tty/vt/vt_ioctl.c Al Viro             2017-09-29  863  		if (copy_from_user(&v, up, sizeof(struct vt_consize)))
1b3bce4d6bf839 drivers/tty/vt/vt_ioctl.c Al Viro             2017-09-29  864  			return -EFAULT;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  865  		/* FIXME: Should check the copies properly */
1b3bce4d6bf839 drivers/tty/vt/vt_ioctl.c Al Viro             2017-09-29  866  		if (!v.v_vlin)
1b3bce4d6bf839 drivers/tty/vt/vt_ioctl.c Al Viro             2017-09-29  867  			v.v_vlin = vc->vc_scan_lines;
1b3bce4d6bf839 drivers/tty/vt/vt_ioctl.c Al Viro             2017-09-29  868  		if (v.v_clin) {
1b3bce4d6bf839 drivers/tty/vt/vt_ioctl.c Al Viro             2017-09-29  869  			int rows = v.v_vlin/v.v_clin;
1b3bce4d6bf839 drivers/tty/vt/vt_ioctl.c Al Viro             2017-09-29  870  			if (v.v_rows != rows) {
1b3bce4d6bf839 drivers/tty/vt/vt_ioctl.c Al Viro             2017-09-29  871  				if (v.v_rows) /* Parameters don't add up */
1b3bce4d6bf839 drivers/tty/vt/vt_ioctl.c Al Viro             2017-09-29  872  					return -EINVAL;
1b3bce4d6bf839 drivers/tty/vt/vt_ioctl.c Al Viro             2017-09-29  873  				v.v_rows = rows;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  874  			}
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  875  		}
1b3bce4d6bf839 drivers/tty/vt/vt_ioctl.c Al Viro             2017-09-29  876  		if (v.v_vcol && v.v_ccol) {
1b3bce4d6bf839 drivers/tty/vt/vt_ioctl.c Al Viro             2017-09-29  877  			int cols = v.v_vcol/v.v_ccol;
1b3bce4d6bf839 drivers/tty/vt/vt_ioctl.c Al Viro             2017-09-29  878  			if (v.v_cols != cols) {
1b3bce4d6bf839 drivers/tty/vt/vt_ioctl.c Al Viro             2017-09-29  879  				if (v.v_cols)
1b3bce4d6bf839 drivers/tty/vt/vt_ioctl.c Al Viro             2017-09-29  880  					return -EINVAL;
1b3bce4d6bf839 drivers/tty/vt/vt_ioctl.c Al Viro             2017-09-29  881  				v.v_cols = cols;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  882  			}
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  883  		}
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  884  
1b3bce4d6bf839 drivers/tty/vt/vt_ioctl.c Al Viro             2017-09-29  885  		if (v.v_clin > 32)
1b3bce4d6bf839 drivers/tty/vt/vt_ioctl.c Al Viro             2017-09-29  886  			return -EINVAL;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  887  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  888  		for (i = 0; i < MAX_NR_CONSOLES; i++) {
6cd1ed50efd882 drivers/tty/vt/vt_ioctl.c Eric Dumazet        2020-02-10  889  			struct vc_data *vcp;
6cd1ed50efd882 drivers/tty/vt/vt_ioctl.c Eric Dumazet        2020-02-10  890  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  891  			if (!vc_cons[i].d)
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  892  				continue;
ac751efa6a0d70 drivers/tty/vt/vt_ioctl.c Torben Hohn         2011-01-25  893  			console_lock();
6cd1ed50efd882 drivers/tty/vt/vt_ioctl.c Eric Dumazet        2020-02-10  894  			vcp = vc_cons[i].d;
6cd1ed50efd882 drivers/tty/vt/vt_ioctl.c Eric Dumazet        2020-02-10  895  			if (vcp) {
1b3bce4d6bf839 drivers/tty/vt/vt_ioctl.c Al Viro             2017-09-29  896  				if (v.v_vlin)
6cd1ed50efd882 drivers/tty/vt/vt_ioctl.c Eric Dumazet        2020-02-10  897  					vcp->vc_scan_lines = v.v_vlin;
1b3bce4d6bf839 drivers/tty/vt/vt_ioctl.c Al Viro             2017-09-29  898  				if (v.v_clin)
6cd1ed50efd882 drivers/tty/vt/vt_ioctl.c Eric Dumazet        2020-02-10  899  					vcp->vc_font.height = v.v_clin;
6cd1ed50efd882 drivers/tty/vt/vt_ioctl.c Eric Dumazet        2020-02-10  900  				vcp->vc_resize_user = 1;
6cd1ed50efd882 drivers/tty/vt/vt_ioctl.c Eric Dumazet        2020-02-10  901  				vc_resize(vcp, v.v_cols, v.v_rows);
6cd1ed50efd882 drivers/tty/vt/vt_ioctl.c Eric Dumazet        2020-02-10  902  			}
ac751efa6a0d70 drivers/tty/vt/vt_ioctl.c Torben Hohn         2011-01-25  903  			console_unlock();
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  904  		}
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  905  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  906  	}
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  907  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  908  	case PIO_FONT: {
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  909  		if (!perm)
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-03-02  910  			return -EPERM;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  911  		op.op = KD_FONT_OP_SET;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  912  		op.flags = KD_FONT_FLAG_OLD | KD_FONT_FLAG_DONT_RECALC;	/* Compatibility */
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  913  		op.width = 8;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  914  		op.height = 0;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  915  		op.charcount = 256;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  916  		op.data = up;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  917  		ret = con_font_op(vc_cons[fg_console].d, &op);
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  918  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  919  	}
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  920  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  921  	case GIO_FONT: {
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  922  		op.op = KD_FONT_OP_GET;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  923  		op.flags = KD_FONT_FLAG_OLD;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  924  		op.width = 8;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  925  		op.height = 32;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  926  		op.charcount = 256;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  927  		op.data = up;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  928  		ret = con_font_op(vc_cons[fg_console].d, &op);
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  929  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  930  	}
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  931  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  932  	case PIO_CMAP:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  933                  if (!perm)
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  934  			ret = -EPERM;
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  935  		else
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  936  	                ret = con_set_cmap(up);
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  937  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  938  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  939  	case GIO_CMAP:
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  940                  ret = con_get_cmap(up);
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  941  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  942  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  943  	case PIO_FONTX:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  944  	case GIO_FONTX:
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  945  		ret = do_fontx_ioctl(cmd, up, perm, &op);
9cc3c22bf017f3 drivers/char/vt_ioctl.c   Alan Cox            2008-04-30  946  		break;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  947  
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  948  	case PIO_FONTRESET:
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  949  	{
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  950  		if (!perm)
4001d7b7fc2710 drivers/tty/vt/vt_ioctl.c Alan Cox            2012-03-02  951  			return -EPERM;
^1da177e4c3f41 drivers/char/vt_ioctl.c   Linus Torvalds      2005-04-16  952  

:::::: The code at line 411 was first introduced by commit
:::::: 079c9534a96da9a85a2a2f9715851050fbfbf749 vt:tackle kbd_table

:::::: TO: Alan Cox <alan@...ux.intel.com>
:::::: CC: Greg Kroah-Hartman <gregkh@...uxfoundation.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" (24959 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ