netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wifi: wil6210: debugfs: fix uninitialized variable use in `wil_write_file_wmi()`
       [not found] <202207250332.5ud26AGE-lkp@intel.com>
@ 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; 3+ 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 <dan.carpenter@oracle.com>
Reported-by: kernel test robot <lkp@intel.com>
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 <ammarfaizi2@gnuweeb.org>
---
 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] 3+ 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; 3+ 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 <dan.carpenter@oracle.com>
> Reported-by: kernel test robot <lkp@intel.com>
> 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 <ammarfaizi2@gnuweeb.org>

Oops.  Sorry!

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 3+ 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; 3+ 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 <ammarfaizi2@gnuweeb.org> 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 <dan.carpenter@oracle.com>
> Reported-by: kernel test robot <lkp@intel.com>
> 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 <ammarfaizi2@gnuweeb.org>
> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

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/20220724202452.61846-1-ammar.faizi@intel.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-27 10:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <202207250332.5ud26AGE-lkp@intel.com>
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;
as well as URLs for NNTP newsgroup(s).