Skip to contentSkip to conversation

rtw88: debug: Fix uninitialized memory in debugfs code

PATCH In review Dan Carpenter 2 participants 4 messages Dec 3, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtw88: debug: Fix uninitialized memory in debugfs code

This code does not ensure that the whole buffer is initialized and none of the callers check for errors so potentially none of the buffer is initialized. Add a memset to eliminate this bug.

Fixes e3037485c68e ("rtw88: new Realtek 802.11ac driver")
---
 drivers/net/wireless/realtek/rtw88/debug.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/wireless/realtek/rtw88/debug.c +2 -0
index 5974a8ef8b34..12efc23bbfcb 100644
@@ -147,6 +147,8 @@ static int rtw_debugfs_copy_from_user(char tmp[], int size,
 {
 	int tmp_len;
 
+	memset(tmp, 0, size);
+
 	if (count < num)
 		return -EFAULT;
 
Signature · 1 line
2.29.2
#1 lore raw
Quoted 9 lines · Dan Carpenter

This code does not ensure that the whole buffer is initialized and none of the callers check for errors so potentially none of the buffer is initialized. Add a memset to eliminate this bug.

Fixes e3037485c68e ("rtw88: new Realtek 802.11ac driver")
---
 drivers/net/wireless/realtek/rtw88/debug.c | 2 ++
 1 file changed, 2 insertions(+)

I'll take this to wireless-drivers, this shouldn't go to net.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#2 lore raw
Quoted 6 lines · Kalle Valo
Quoted 4 lines · Dan Carpenter

This code does not ensure that the whole buffer is initialized and none of the callers check for errors so potentially none of the buffer is initialized. Add a memset to eliminate this bug.

Quoted 7 lines
Quoted 5 lines
Fixes e3037485c68e ("rtw88: new Realtek 802.11ac driver")
---
 drivers/net/wireless/realtek/rtw88/debug.c | 2 ++
 1 file changed, 2 insertions(+)

I'll take this to wireless-drivers, this shouldn't go to net.

Ugh... The worst part about that is that I manually added the "net" part without thinking thouroughly. :/ Anyway, I've modified my QC scripts now.

regards,
dan carpenter

#3 lore raw
In reply to Dan Carpenter
Quoted 6 lines · Dan Carpenter

This code does not ensure that the whole buffer is initialized and none of the callers check for errors so potentially none of the buffer is initialized. Add a memset to eliminate this bug.

Fixes e3037485c68e ("rtw88: new Realtek 802.11ac driver")

Patch applied to wireless-drivers.git, thanks.

74a8c816fa8f rtw88: debug: Fix uninitialized memory in debugfs code

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/X8ilOfVz3pf0T5ec@mwanda/

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