From patchwork Tue Feb 14 09:38:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masashi Honma X-Patchwork-Id: 9571523 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B6AA3601E7 for ; Tue, 14 Feb 2017 09:39:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A33B227D8D for ; Tue, 14 Feb 2017 09:39:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 981AA2836B; Tue, 14 Feb 2017 09:39:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3511027D8D for ; Tue, 14 Feb 2017 09:39:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752960AbdBNJjM (ORCPT ); Tue, 14 Feb 2017 04:39:12 -0500 Received: from mail-oi0-f65.google.com ([209.85.218.65]:33570 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752573AbdBNJjJ (ORCPT ); Tue, 14 Feb 2017 04:39:09 -0500 Received: by mail-oi0-f65.google.com with SMTP id j15so2497161oih.0 for ; Tue, 14 Feb 2017 01:39:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FvOeKuDoWFA870J8WCF3u+NVDJkaO527MYlgMqsvFt8=; b=tyE/NZvg2XqQUd4b0Fct3cUlYYV6gULlHaq2ut0V+kY5i5xRf084W0mJPvmm3XoVQr wlHVCIMc4oo6d2hwADUDkMwUrvRXuztxpUfO+OJ2B2VJSLZYtWjErh8jH7tqfd8HQH0x y/AhszB9PBLAApwniGqOF3jhurHCzBZlGC7eKb58k/mFBRD6g4lsRoLb3WW8HvISe7xM DmtPoOpAZ0hO+RtC7KeXAegoe40UYVRxqNHrv8zg5cuFjR+SY0GI+E7Y8nnOeXUtu98q 84T5aWumdlyFvt9JdfGPeqlAde4tqA9uqx1+Vhk2XYPqSZvJXemTyQj8eko5m+JghhLu CRBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FvOeKuDoWFA870J8WCF3u+NVDJkaO527MYlgMqsvFt8=; b=r7JS7G0kZR+Bqin5P0v5pFBLgIh8VnoOP+mEx7KKLNZPohC8951G6k7ndHBaVZ2KYU IRry/YBIoWngy+7mHt0qbST5ZZW+UCs8RXrDWtYX7TMzvLZzYoBwb5+j4A1k0XhiY1Hn muLjtprMIZUh6x+MVbijJLQoQc5FVQzNZ7aIfnOM5YilwX5ohZoTTJPEW55IRnVopWsX 2YVNUdghSBKaqFcdcOnjWgIhHraO75rzz8XgocAMAb1eLfoUw5cwr/xw1HKYfmId8LHi CQxI5IYu0V08Rtaj7jSIL9mJbMGP7qUprjHhjIdHP74G/ZvdNOiO5dkPtg1G2nHYikgH OX/w== X-Gm-Message-State: AMke39mvx+Ei/K9ULpbl8ox/Mg0X1rssn8ZiTFy7Fmsm89s0PUgaHO5277WXGoCyGxkmiA== X-Received: by 10.84.196.131 with SMTP id l3mr35738953pld.150.1487065148925; Tue, 14 Feb 2017 01:39:08 -0800 (PST) Received: from localhost.localdomain (p6e106c.kngwnt01.ap.so-net.ne.jp. [218.110.16.108]) by smtp.gmail.com with ESMTPSA id 19sm19528998pfj.107.2017.02.14.01.39.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Feb 2017 01:39:08 -0800 (PST) From: Masashi Honma To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Masashi Honma Subject: [PATCH v2] iw: Fix bitrate output when no rate info found Date: Tue, 14 Feb 2017 18:38:58 +0900 Message-Id: <1487065138-4892-1-git-send-email-masashi.honma@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487049663-2942-1-git-send-email-masashi.honma@gmail.com> References: <1487049663-2942-1-git-send-email-masashi.honma@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Previously, bitrate showed uninitialized buffer when no rate info found. This patch fixes the issue. Signed-off-by: Masashi Honma --- station.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/station.c b/station.c index f3e3da8..4885dc0 100644 --- a/station.c +++ b/station.c @@ -151,6 +151,8 @@ 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 + pos += snprintf(pos, buflen - (pos - buf), "(unknown)"); if (rinfo[NL80211_RATE_INFO_MCS]) pos += snprintf(pos, buflen - (pos - buf),