Linux wireless drivers development
 help / color / mirror / Atom feed
From: Masashi Honma <masashi.honma@gmail.com>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org, Masashi Honma <masashi.honma@gmail.com>
Subject: [PATCH] iw: Fix bitrate output when no rate info found
Date: Tue, 14 Feb 2017 14:21:03 +0900	[thread overview]
Message-ID: <1487049663-2942-1-git-send-email-masashi.honma@gmail.com> (raw)

Previously, bitrate showed uninitialized buffer when no rate info found.
This patch fixes the issue.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
---
 station.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/station.c b/station.c
index f3e3da8..9d3eb4d 100644
--- a/station.c
+++ b/station.c
@@ -151,6 +151,10 @@ void parse_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen)
 	if (rate > 0)
 		pos += snprintf(pos, buflen - (pos - buf),
 				"%d.%d MBit/s", rate / 10, rate % 10);
+	else {
+		snprintf(buf, buflen, "No rate info found!");
+		return;
+	}
 
 	if (rinfo[NL80211_RATE_INFO_MCS])
 		pos += snprintf(pos, buflen - (pos - buf),
-- 
2.7.4

             reply	other threads:[~2017-02-14  5:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-14  5:21 Masashi Honma [this message]
2017-02-14  5:26 ` [PATCH] iw: Fix bitrate output when no rate info found Masashi Honma
2017-02-14  8:35 ` Johannes Berg
2017-02-14  8:55   ` Masashi Honma
2017-02-14  9:14     ` Johannes Berg
2017-02-14  9:35       ` Masashi Honma
2017-02-14  9:38 ` [PATCH v2] " Masashi Honma
2017-02-14  9:45   ` Johannes Berg

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=1487049663-2942-1-git-send-email-masashi.honma@gmail.com \
    --to=masashi.honma@gmail.com \
    --cc=johannes@sipsolutions.net \
    --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