Linux wireless drivers development
 help / color / mirror / Atom feed
From: <ryanhsu@qca.qualcomm.com>
To: <ath10k@lists.infradead.org>, <linux-wireless@vger.kernel.org>
Cc: <ryanhsu@qca.qualcomm.com>
Subject: [PATCH] ath10k: fix the garage chars in board file name creation
Date: Fri, 10 Feb 2017 12:27:09 -0800	[thread overview]
Message-ID: <1486758429-18665-1-git-send-email-ryanhsu@qca.qualcomm.com> (raw)

From: Ryan Hsu <ryanhsu@qca.qualcomm.com>

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>
---
 drivers/net/wireless/ath/ath10k/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index c27e7ea..014a87e 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1122,7 +1122,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,
-- 
1.9.1

             reply	other threads:[~2017-02-10 20:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-10 20:27 ryanhsu [this message]
2017-02-14 17:57 ` ath10k: fix the garage chars in board file name creation Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1486758429-18665-1-git-send-email-ryanhsu@qca.qualcomm.com \
    --to=ryanhsu@qca.qualcomm.com \
    --cc=ath10k@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox