]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ath10k: fix the garage chars in board file name creation
authorRyan Hsu <ryanhsu@qca.qualcomm.com>
Fri, 10 Feb 2017 20:27:09 +0000 (12:27 -0800)
committerKalle Valo <kvalo@qca.qualcomm.com>
Tue, 14 Feb 2017 17:56:45 +0000 (19:56 +0200)
The variant[] string will be valid only if the bdf_ext is set.

The string memory needs to be null-terminated to avoid the undefined garbage
appended by the subsequent board file name creation.

ath10k_pci 0000:04:00.0: failed to fetch board data for
"bus=pci,vendor=168c,device=003e,subsystem-vendor=168c,subsystem-device=3363��P�����"
from ath10k/QCA6174/hw3.0/board-2.bin

Fixes: f2593cb1b291 ("ath10k: Search SMBIOS for OEM board file extension")
Reported-by: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: Ryan Hsu <ryanhsu@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath10k/core.c

index 499ee7b41771515ece306b03c054620d0085c6a2..59729aa8cd821a5e3b6e148f4f5b02c4d493824e 100644 (file)
@@ -1126,7 +1126,7 @@ static int ath10k_core_create_board_name(struct ath10k *ar, char *name,
                                         size_t name_len)
 {
        /* strlen(',variant=') + strlen(ar->id.bdf_ext) */
-       char variant[9 + ATH10K_SMBIOS_BDF_EXT_STR_LENGTH];
+       char variant[9 + ATH10K_SMBIOS_BDF_EXT_STR_LENGTH] = { 0 };
 
        if (ar->id.bmi_ids_valid) {
                scnprintf(name, name_len,