From patchwork Wed Dec 22 15:58:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 12691803 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 4F0B5C433FE for ; Wed, 22 Dec 2021 15:58:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344029AbhLVP6x (ORCPT ); Wed, 22 Dec 2021 10:58:53 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:51831 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343803AbhLVP6V (ORCPT ); Wed, 22 Dec 2021 10:58:21 -0500 Received: (Authenticated sender: miquel.raynal@bootlin.com) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id D1A7BE0012; Wed, 22 Dec 2021 15:58:18 +0000 (UTC) From: Miquel Raynal To: Alexander Aring , Stefan Schmidt , linux-wpan@vger.kernel.org Cc: David Girault , Romuald Despres , Frederic Blain , Thomas Petazzoni , netdev@vger.kernel.org, Romuald Despres , Miquel Raynal Subject: [wpan-tools 1/7] iwpan: Fix the channels printing Date: Wed, 22 Dec 2021 16:58:10 +0100 Message-Id: <20211222155816.256405-2-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211222155816.256405-1-miquel.raynal@bootlin.com> References: <20211222155816.256405-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wpan@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;