From patchwork Wed Jan 12 17:35:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 531762 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 961A7C433FE for ; Wed, 12 Jan 2022 17:35:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240586AbiALRfs (ORCPT ); Wed, 12 Jan 2022 12:35:48 -0500 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:48013 "EHLO relay6-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355696AbiALRff (ORCPT ); Wed, 12 Jan 2022 12:35:35 -0500 Received: (Authenticated sender: miquel.raynal@bootlin.com) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id A48B9C0005; Wed, 12 Jan 2022 17:35:32 +0000 (UTC) From: Miquel Raynal To: Alexander Aring , Stefan Schmidt , linux-wpan@vger.kernel.org, "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org Cc: David Girault , Romuald Despres , Frederic Blain , Nicolas Schodet , Thomas Petazzoni , linux-wireless@vger.kernel.org, Romuald Despres , Miquel Raynal Subject: [wpan-tools v2 1/7] iwpan: Fix the channels printing Date: Wed, 12 Jan 2022 18:35:23 +0100 Message-Id: <20220112173529.765170-2-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220112173529.765170-1-miquel.raynal@bootlin.com> References: <20220112173529.765170-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Romuald Despres The presence of a channel capability is checked against the tb_msg netlink attributes array which is the root one, while here we are looking for channel capabilities, themselves being nested and parsed into tb_caps. Use tb_caps instead of tb_msg here otherwise we are accessing a random index in the upper attributes list. Signed-off-by: Romuald Despres Signed-off-by: Miquel Raynal --- src/info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/info.c b/src/info.c index f85690c..8ed5e4f 100644 --- a/src/info.c +++ b/src/info.c @@ -342,7 +342,7 @@ static int print_phy_handler(struct nl_msg *msg, void *arg) printf("\b \n"); } - if (tb_msg[NL802154_CAP_ATTR_CHANNELS]) { + if (tb_caps[NL802154_CAP_ATTR_CHANNELS]) { int counter = 0; int rem_pages; struct nlattr *nl_pages;