tree:
https://git.kernel.org/pub/scm/linux/kernel/git/jirislaby/linux.git devel
head: 33533f1d99b53918d785901267d045f2964bfe5c
commit: a959de21141d5d2600cdfda7c4df5fa816fb6d38 [15/52] vt: keyboard, extract and
simplify vt_kdskbsent
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
#
https://git.kernel.org/pub/scm/linux/kernel/git/jirislaby/linux.git/commi...
git remote add jirislaby
https://git.kernel.org/pub/scm/linux/kernel/git/jirislaby/linux.git
git fetch --no-tags jirislaby devel
git checkout a959de21141d5d2600cdfda7c4df5fa816fb6d38
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
drivers/tty/vt/keyboard.c: In function 'vt_do_kdgkb_ioctl':
drivers/tty/vt/keyboard.c:2063:3: error: 'ret' undeclared (first use in this
function); did you mean 'rep'?
2063 | ret = copy_to_user(user_kdgkb->kb_string, func_copy, len + 1) ?
| ^~~
| rep
drivers/tty/vt/keyboard.c:2063:3: note: each undeclared identifier is reported only
once for each function it appears in
> drivers/tty/vt/keyboard.c:2066:3: warning: this statement may
fall through [-Wimplicit-fallthrough=]
2066 | kfree(func_copy);
| ^~~~~~~~~~~~~~~~
drivers/tty/vt/keyboard.c:2070:2: note: here
2070 | case KDSKBSENT: {
| ^~~~
vim +2066 drivers/tty/vt/keyboard.c
a959de21141d5d2 Jiri Slaby 2020-08-18 2035
079c9534a96da9a Alan Cox 2012-02-28 2036 int vt_do_kdgkb_ioctl(int cmd, struct
kbsentry __user *user_kdgkb, int perm)
079c9534a96da9a Alan Cox 2012-02-28 2037 {
76f8a0386a60170 Jiri Slaby 2020-08-18 2038 unsigned char kb_func;
a959de21141d5d2 Jiri Slaby 2020-08-18 2039 unsigned long flags;
079c9534a96da9a Alan Cox 2012-02-28 2040
079c9534a96da9a Alan Cox 2012-02-28 2041 if (!capable(CAP_SYS_TTY_CONFIG))
079c9534a96da9a Alan Cox 2012-02-28 2042 perm = 0;
079c9534a96da9a Alan Cox 2012-02-28 2043
76f8a0386a60170 Jiri Slaby 2020-08-18 2044 if (get_user(kb_func,
&user_kdgkb->kb_func))
0d918baecc9263e Jiri Slaby 2020-08-14 2045 return -EFAULT;
079c9534a96da9a Alan Cox 2012-02-28 2046
76f8a0386a60170 Jiri Slaby 2020-08-18 2047 kb_func =
array_index_nospec(kb_func, MAX_NR_FUNC);
079c9534a96da9a Alan Cox 2012-02-28 2048
079c9534a96da9a Alan Cox 2012-02-28 2049 switch (cmd) {
8092d18a17ab730 Jiri Slaby 2020-08-14 2050 case KDGKBSENT: {
8092d18a17ab730 Jiri Slaby 2020-08-14 2051 /* size should have been a struct
member */
54b82ccf041264d Jiri Slaby 2020-09-01 2052 char *func_copy;
54b82ccf041264d Jiri Slaby 2020-09-01 2053 ssize_t len =
sizeof(user_kdgkb->kb_string);
0d918baecc9263e Jiri Slaby 2020-08-14 2054
54b82ccf041264d Jiri Slaby 2020-09-01 2055 func_copy = kmalloc(len,
GFP_KERNEL);
54b82ccf041264d Jiri Slaby 2020-09-01 2056 if (!func_copy)
54b82ccf041264d Jiri Slaby 2020-09-01 2057 return -ENOMEM;
0d918baecc9263e Jiri Slaby 2020-08-14 2058
54b82ccf041264d Jiri Slaby 2020-09-01 2059
spin_lock_irqsave(&func_buf_lock, flags);
76f8a0386a60170 Jiri Slaby 2020-08-18 2060 len = strlcpy(func_copy,
func_table[kb_func] ? : "", len);
54b82ccf041264d Jiri Slaby 2020-09-01 2061
spin_unlock_irqrestore(&func_buf_lock, flags);
54b82ccf041264d Jiri Slaby 2020-09-01 2062
54b82ccf041264d Jiri Slaby 2020-09-01 2063 ret =
copy_to_user(user_kdgkb->kb_string, func_copy, len + 1) ?
54b82ccf041264d Jiri Slaby 2020-09-01 2064 -EFAULT : 0;
54b82ccf041264d Jiri Slaby 2020-09-01 2065
54b82ccf041264d Jiri Slaby 2020-09-01 @2066 kfree(func_copy);
54b82ccf041264d Jiri Slaby 2020-09-01 2067
54b82ccf041264d Jiri Slaby 2020-09-01 2068 return ret;
8092d18a17ab730 Jiri Slaby 2020-08-14 2069 }
a959de21141d5d2 Jiri Slaby 2020-08-18 2070 case KDSKBSENT: {
a959de21141d5d2 Jiri Slaby 2020-08-18 2071 char *kbs;
a959de21141d5d2 Jiri Slaby 2020-08-18 2072
0d918baecc9263e Jiri Slaby 2020-08-14 2073 if (!perm)
0d918baecc9263e Jiri Slaby 2020-08-14 2074 return -EPERM;
0d918baecc9263e Jiri Slaby 2020-08-14 2075
0d918baecc9263e Jiri Slaby 2020-08-14 2076 kbs =
strndup_user(user_kdgkb->kb_string,
0d918baecc9263e Jiri Slaby 2020-08-14 2077
sizeof(user_kdgkb->kb_string));
0d918baecc9263e Jiri Slaby 2020-08-14 2078 if (IS_ERR(kbs))
0d918baecc9263e Jiri Slaby 2020-08-14 2079 return PTR_ERR(kbs);
079c9534a96da9a Alan Cox 2012-02-28 2080
46ca3f735f345c9 Sergei Trofimovich 2019-03-10 2081
spin_lock_irqsave(&func_buf_lock, flags);
a959de21141d5d2 Jiri Slaby 2020-08-18 2082 kbs = vt_kdskbsent(kbs, kb_func);
46ca3f735f345c9 Sergei Trofimovich 2019-03-10 2083
spin_unlock_irqrestore(&func_buf_lock, flags);
a959de21141d5d2 Jiri Slaby 2020-08-18 2084
079c9534a96da9a Alan Cox 2012-02-28 2085 kfree(kbs);
a959de21141d5d2 Jiri Slaby 2020-08-18 2086
a959de21141d5d2 Jiri Slaby 2020-08-18 2087 return 0;
a959de21141d5d2 Jiri Slaby 2020-08-18 2088 }
a959de21141d5d2 Jiri Slaby 2020-08-18 2089 }
a959de21141d5d2 Jiri Slaby 2020-08-18 2090
a959de21141d5d2 Jiri Slaby 2020-08-18 2091 return 0;
079c9534a96da9a Alan Cox 2012-02-28 2092 }
079c9534a96da9a Alan Cox 2012-02-28 2093
:::::: The code at line 2066 was first introduced by commit
:::::: 54b82ccf041264dfd324f62719a430483a823028 vt: keyboard, extend func_buf_lock to
readers
:::::: TO: Jiri Slaby <jslaby(a)suse.cz>
:::::: CC: Jiri Slaby <jslaby(a)suse.cz>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org