[ammarfaizi2-block:kvalo/ath/pending 3/9] drivers/net/wireless/ath/wil6210/debugfs.c:1030:9: warning: variable 'rc' is uninitialized when used here

From: kernel test robot
Date: Sun Jul 24 2022 - 15:48:57 EST


tree: https://github.com/ammarfaizi2/linux-block kvalo/ath/pending
head: 086f67ba21ede199307e78476353bda9ffef982c
commit: 7a4836560a6198d245d5732e26f94898b12eb760 [3/9] wifi: wil6210: debugfs: fix info leak in wil_write_file_wmi()
config: powerpc-randconfig-r002-20220718 (https://download.01.org/0day-ci/archive/20220725/202207250332.5ud26AGE-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d74b88c69dc2644bd0dc5d64e2d7413a0d4040e5)
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
# install powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
# https://github.com/ammarfaizi2/linux-block/commit/7a4836560a6198d245d5732e26f94898b12eb760
git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
git fetch --no-tags ammarfaizi2-block kvalo/ath/pending
git checkout 7a4836560a6198d245d5732e26f94898b12eb760
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash drivers/net/wireless/ath/wil6210/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/net/wireless/ath/wil6210/debugfs.c:1030:9: warning: variable 'rc' is uninitialized when used here [-Wuninitialized]
return rc;
^~
drivers/net/wireless/ath/wil6210/debugfs.c:1013:8: note: initialize the variable 'rc' to silence this warning
int rc, rc1;
^
= 0
1 warning generated.


vim +/rc +1030 drivers/net/wireless/ath/wil6210/debugfs.c

2be7d22f062535 Vladimir Kondratiev 2012-12-20 1000
ff974e40833413 Vladimir Kondratiev 2014-06-16 1001 /* Write WMI command (w/o mbox header) to this file to send it
ff974e40833413 Vladimir Kondratiev 2014-06-16 1002 * WMI starts from wil6210_mbox_hdr_wmi header
ff974e40833413 Vladimir Kondratiev 2014-06-16 1003 */
ff974e40833413 Vladimir Kondratiev 2014-06-16 1004 static ssize_t wil_write_file_wmi(struct file *file, const char __user *buf,
ff974e40833413 Vladimir Kondratiev 2014-06-16 1005 size_t len, loff_t *ppos)
ff974e40833413 Vladimir Kondratiev 2014-06-16 1006 {
ff974e40833413 Vladimir Kondratiev 2014-06-16 1007 struct wil6210_priv *wil = file->private_data;
e00243fab84b4e Lior David 2018-02-26 1008 struct wil6210_vif *vif = ndev_to_vif(wil->main_ndev);
b874ddecae0a08 Lior David 2016-03-01 1009 struct wmi_cmd_hdr *wmi;
ff974e40833413 Vladimir Kondratiev 2014-06-16 1010 void *cmd;
b874ddecae0a08 Lior David 2016-03-01 1011 int cmdlen = len - sizeof(struct wmi_cmd_hdr);
ff974e40833413 Vladimir Kondratiev 2014-06-16 1012 u16 cmdid;
ff974e40833413 Vladimir Kondratiev 2014-06-16 1013 int rc, rc1;
ff974e40833413 Vladimir Kondratiev 2014-06-16 1014
7a4836560a6198 Dan Carpenter 2022-07-15 1015 if (cmdlen < 0 || *ppos != 0)
ff974e40833413 Vladimir Kondratiev 2014-06-16 1016 return -EINVAL;
ff974e40833413 Vladimir Kondratiev 2014-06-16 1017
7a4836560a6198 Dan Carpenter 2022-07-15 1018 wmi = memdup_user(buf, len);
7a4836560a6198 Dan Carpenter 2022-07-15 1019 if (IS_ERR(wmi))
7a4836560a6198 Dan Carpenter 2022-07-15 1020 return PTR_ERR(wmi);
ff974e40833413 Vladimir Kondratiev 2014-06-16 1021
69218a48005d0c Lior David 2016-03-21 1022 cmd = (cmdlen > 0) ? &wmi[1] : NULL;
b874ddecae0a08 Lior David 2016-03-01 1023 cmdid = le16_to_cpu(wmi->command_id);
ff974e40833413 Vladimir Kondratiev 2014-06-16 1024
e00243fab84b4e Lior David 2018-02-26 1025 rc1 = wmi_send(wil, cmdid, vif->mid, cmd, cmdlen);
ff974e40833413 Vladimir Kondratiev 2014-06-16 1026 kfree(wmi);
ff974e40833413 Vladimir Kondratiev 2014-06-16 1027
af3db60a30331d Lazar Alexei 2017-01-20 1028 wil_info(wil, "0x%04x[%d] -> %d\n", cmdid, cmdlen, rc1);
ff974e40833413 Vladimir Kondratiev 2014-06-16 1029
ff974e40833413 Vladimir Kondratiev 2014-06-16 @1030 return rc;
ff974e40833413 Vladimir Kondratiev 2014-06-16 1031 }
ff974e40833413 Vladimir Kondratiev 2014-06-16 1032

:::::: The code at line 1030 was first introduced by commit
:::::: ff974e4083341383d3dd4079e52ed30f57f376f0 wil6210: debugfs interface to send raw WMI command

:::::: TO: Vladimir Kondratiev <qca_vkondrat@xxxxxxxxxxxxxxxx>
:::::: CC: John W. Linville <linville@xxxxxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://01.org/lkp