* [ammarfaizi2-block:kvalo/ath/pending 3/9] drivers/net/wireless/ath/wil6210/debugfs.c:1030:9: warning: variable 'rc' is uninitialized when used here
@ 2022-07-24 19:44 kernel test robot
2022-07-24 20:26 ` [PATCH] wifi: wil6210: debugfs: fix uninitialized variable use in `wil_write_file_wmi()` Ammar Faizi
0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2022-07-24 19:44 UTC (permalink / raw)
To: Dan Carpenter
Cc: llvm, kbuild-all, Ammar Faizi, GNU/Weeb Mailing List,
linux-kernel, Kalle Valo
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/[email protected]/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 <[email protected]>
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 <[email protected]>
:::::: CC: John W. Linville <[email protected]>
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] wifi: wil6210: debugfs: fix uninitialized variable use in `wil_write_file_wmi()`
2022-07-24 19:44 [ammarfaizi2-block:kvalo/ath/pending 3/9] drivers/net/wireless/ath/wil6210/debugfs.c:1030:9: warning: variable 'rc' is uninitialized when used here kernel test robot
@ 2022-07-24 20:26 ` Ammar Faizi
2022-07-25 6:34 ` Dan Carpenter
2022-07-27 10:20 ` Kalle Valo
0 siblings, 2 replies; 4+ messages in thread
From: Ammar Faizi @ 2022-07-24 20:26 UTC (permalink / raw)
To: Kalle Valo
Cc: Ammar Faizi, Kalle Valo, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Dan Carpenter, Johannes Berg,
Linux Wireless Mailing List, netdev Mailing List,
Linux Kernel Mailing List, GNU/Weeb Mailing List, llvm,
kbuild-all, kernel test robot
Commit 7a4836560a61 changes simple_write_to_buffer() with memdup_user()
but it forgets to change the value to be returned that came from
simple_write_to_buffer() call. It results in the following warning:
warning: variable 'rc' is uninitialized when used here [-Wuninitialized]
return rc;
^~
Remove rc variable and just return the passed in length if the
memdup_user() succeeds.
Cc: Dan Carpenter <[email protected]>
Reported-by: kernel test robot <[email protected]>
Fixes: 7a4836560a6198d245d5732e26f94898b12eb760 ("wifi: wil6210: debugfs: fix info leak in wil_write_file_wmi()")
Fixes: ff974e4083341383d3dd4079e52ed30f57f376f0 ("wil6210: debugfs interface to send raw WMI command")
Signed-off-by: Ammar Faizi <[email protected]>
---
drivers/net/wireless/ath/wil6210/debugfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c
index fe84362718de..04d1aa0e2d35 100644
--- a/drivers/net/wireless/ath/wil6210/debugfs.c
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -1010,7 +1010,7 @@ static ssize_t wil_write_file_wmi(struct file *file, const char __user *buf,
void *cmd;
int cmdlen = len - sizeof(struct wmi_cmd_hdr);
u16 cmdid;
- int rc, rc1;
+ int rc1;
if (cmdlen < 0 || *ppos != 0)
return -EINVAL;
@@ -1027,7 +1027,7 @@ static ssize_t wil_write_file_wmi(struct file *file, const char __user *buf,
wil_info(wil, "0x%04x[%d] -> %d\n", cmdid, cmdlen, rc1);
- return rc;
+ return len;
}
static const struct file_operations fops_wmi = {
base-commit: 086f67ba21ede199307e78476353bda9ffef982c
--
Ammar Faizi
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] wifi: wil6210: debugfs: fix uninitialized variable use in `wil_write_file_wmi()`
2022-07-24 20:26 ` [PATCH] wifi: wil6210: debugfs: fix uninitialized variable use in `wil_write_file_wmi()` Ammar Faizi
@ 2022-07-25 6:34 ` Dan Carpenter
2022-07-27 10:20 ` Kalle Valo
1 sibling, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2022-07-25 6:34 UTC (permalink / raw)
To: Ammar Faizi
Cc: Kalle Valo, Kalle Valo, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Johannes Berg, Linux Wireless Mailing List, netdev Mailing List,
Linux Kernel Mailing List, GNU/Weeb Mailing List, llvm,
kbuild-all, kernel test robot
On Mon, Jul 25, 2022 at 03:26:18AM +0700, Ammar Faizi wrote:
> Commit 7a4836560a61 changes simple_write_to_buffer() with memdup_user()
> but it forgets to change the value to be returned that came from
> simple_write_to_buffer() call. It results in the following warning:
>
> warning: variable 'rc' is uninitialized when used here [-Wuninitialized]
> return rc;
> ^~
>
> Remove rc variable and just return the passed in length if the
> memdup_user() succeeds.
>
> Cc: Dan Carpenter <[email protected]>
> Reported-by: kernel test robot <[email protected]>
> Fixes: 7a4836560a6198d245d5732e26f94898b12eb760 ("wifi: wil6210: debugfs: fix info leak in wil_write_file_wmi()")
> Fixes: ff974e4083341383d3dd4079e52ed30f57f376f0 ("wil6210: debugfs interface to send raw WMI command")
> Signed-off-by: Ammar Faizi <[email protected]>
Oops. Sorry!
Reviewed-by: Dan Carpenter <[email protected]>
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] wifi: wil6210: debugfs: fix uninitialized variable use in `wil_write_file_wmi()`
2022-07-24 20:26 ` [PATCH] wifi: wil6210: debugfs: fix uninitialized variable use in `wil_write_file_wmi()` Ammar Faizi
2022-07-25 6:34 ` Dan Carpenter
@ 2022-07-27 10:20 ` Kalle Valo
1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2022-07-27 10:20 UTC (permalink / raw)
To: Ammar Faizi
Cc: Ammar Faizi, Kalle Valo, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Dan Carpenter, Johannes Berg,
Linux Wireless Mailing List, netdev Mailing List,
Linux Kernel Mailing List, GNU/Weeb Mailing List, llvm,
kbuild-all, kernel test robot
Ammar Faizi <[email protected]> wrote:
> Commit 7a4836560a61 changes simple_write_to_buffer() with memdup_user()
> but it forgets to change the value to be returned that came from
> simple_write_to_buffer() call. It results in the following warning:
>
> warning: variable 'rc' is uninitialized when used here [-Wuninitialized]
> return rc;
> ^~
>
> Remove rc variable and just return the passed in length if the
> memdup_user() succeeds.
>
> Cc: Dan Carpenter <[email protected]>
> Reported-by: kernel test robot <[email protected]>
> Fixes: 7a4836560a6198d245d5732e26f94898b12eb760 ("wifi: wil6210: debugfs: fix info leak in wil_write_file_wmi()")
> Fixes: ff974e4083341383d3dd4079e52ed30f57f376f0 ("wil6210: debugfs interface to send raw WMI command")
> Signed-off-by: Ammar Faizi <[email protected]>
> Reviewed-by: Dan Carpenter <[email protected]>
> Signed-off-by: Kalle Valo <[email protected]>
Patch applied to ath-next branch of ath.git, thanks.
d578e0af3a00 wifi: wil6210: debugfs: fix uninitialized variable use in `wil_write_file_wmi()`
--
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-07-27 10:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-24 19:44 [ammarfaizi2-block:kvalo/ath/pending 3/9] drivers/net/wireless/ath/wil6210/debugfs.c:1030:9: warning: variable 'rc' is uninitialized when used here kernel test robot
2022-07-24 20:26 ` [PATCH] wifi: wil6210: debugfs: fix uninitialized variable use in `wil_write_file_wmi()` Ammar Faizi
2022-07-25 6:34 ` Dan Carpenter
2022-07-27 10:20 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox