rtw88: debug: Fix uninitialized memory in debugfs code
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 3 Dec 2020 08:43:37 +0000 (11:43 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 3 Dec 2020 16:00:45 +0000 (18:00 +0200)
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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/X8ilOfVz3pf0T5ec@mwanda
drivers/net/wireless/realtek/rtw88/debug.c

index 3852c4f0ac0b094c9fb44b848fcdd4b283ba3a3a..efbba9caef3bfef87015c5d506c3ecdeb3a1cff4 100644 (file)
@@ -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;