From patchwork Tue Feb 14 05:21:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masashi Honma X-Patchwork-Id: 9571211 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 8F861601E7 for ; Tue, 14 Feb 2017 05:21:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7402F27FA8 for ; Tue, 14 Feb 2017 05:21:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6608628174; Tue, 14 Feb 2017 05:21:31 +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 0872227FA8 for ; Tue, 14 Feb 2017 05:21:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751583AbdBNFV2 (ORCPT ); Tue, 14 Feb 2017 00:21:28 -0500 Received: from mail-oi0-f66.google.com ([209.85.218.66]:33277 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750908AbdBNFV2 (ORCPT ); Tue, 14 Feb 2017 00:21:28 -0500 Received: by mail-oi0-f66.google.com with SMTP id j15so1872124oih.0 for ; Mon, 13 Feb 2017 21:21:27 -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; bh=A5BJjvXzkkQtcRENEw3ZWpPA9NE6zDspO/j5gQ4OJ0s=; b=b8cAuGzPxONrR89hGxlvae+/v7VzHntxpJN1qTs4duT3zqkijbEZrtez5tjJxHWT8n c9c38eFuIXeJgV3XoVTkUQx8HWNAfyaiZ2ZxeZhVcEU7vgl2RUGzz5bVMop5HU7MYnWW CSbpSSUdfJltXqJkeDUxstf4KQuH+cbm4Ee78Q9by3uwt2hs56WnOmhWUXsLlp/NMv0J 6DzWuP6B9dm+0ITKwII69pHDeJsbVp1UCaZytDjtFqv44o7usgzoSKhacmIlS4bfFAHp Alg/aQ2yapwZ0RaLuQJFAyxlV2Y3z2hwiblph4YW3sAnw5WJmJLz1LpFo11Od8XApL+S Ss7g== 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; bh=A5BJjvXzkkQtcRENEw3ZWpPA9NE6zDspO/j5gQ4OJ0s=; b=MOK4OKkRjYILAbUHneSeUSApe6+aY/CnhcgKiztiNshQpu/KVMFpeiQ9RGgmAVu3fg 46+sXdqZB/laJoaQfh39LO2Z5U4u9EswFPBzLmIcFnJvmnSV5Yk5ylJGWo+9LlbTvfLa IE/OtKelFGWNUfKcDASb95cvcahHFuODMs/+fCvKzxsKnCrPPkBPOvaOaZiulIYYQG+Q jq7m2DOJgNDUMIvjcjfC63OJEhTwQJ0puHABi6oujt3ZIYo0ndfb/cMpAf/+SAl9Nk47 Yx8pbbGlUZra9gevg1EOPv6QUCKwVmoKJ/RlTACp4yj3oDIndH/s599fz8rUFjlDSbkc eiPg== X-Gm-Message-State: AMke39lKQlt58r9UvrHF5S7IoEoQJOhHRsZOms8o8LB88KPEoiPOw9sKog2e4FF55EYA/A== X-Received: by 10.84.225.150 with SMTP id u22mr7850142plj.91.1487049686940; Mon, 13 Feb 2017 21:21:26 -0800 (PST) Received: from localhost.localdomain (p6e106c.kngwnt01.ap.so-net.ne.jp. [218.110.16.108]) by smtp.gmail.com with ESMTPSA id k78sm23861834pfb.93.2017.02.13.21.21.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Feb 2017 21:21:26 -0800 (PST) From: Masashi Honma To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Masashi Honma Subject: [PATCH] iw: Fix bitrate output when no rate info found Date: Tue, 14 Feb 2017 14:21:03 +0900 Message-Id: <1487049663-2942-1-git-send-email-masashi.honma@gmail.com> X-Mailer: git-send-email 2.7.4 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 | 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),