From patchwork Mon Sep 5 20:27:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 12966513 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 C06E9C6FA8B for ; Mon, 5 Sep 2022 20:29:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232105AbiIEU3J (ORCPT ); Mon, 5 Sep 2022 16:29:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232083AbiIEU21 (ORCPT ); Mon, 5 Sep 2022 16:28:27 -0400 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C0C26527F; Mon, 5 Sep 2022 13:27:29 -0700 (PDT) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 64B5C1BF205; Mon, 5 Sep 2022 20:27:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1662409648; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BnHOMbYg/aYl52AglqRA9BaFquWx+XID3a4n+UoH8uw=; b=N1U/6Vb2fG5pGVLAg0qN0sSEVox4muuwFpYwGAICmvmIG6cLzE+jhmQequc91EkBmZkb+k 38mGDsVxA4DsNSii2RXOoZ9xYeddg7Cjuo14omQlg6IhCglobjBxGRC4G4Mern7eg6IzyT xbeZ/hJ6MAd5zhu5jX2zVo5w1W3ODGJ51+eSFY5psErOCfoGftPCQFyBzqjIvepfVBMbPO cXC/XCf+5VisYuithX7QqodHUYGXRiNp8ygv60slGzqzn0bEfKzFB87SNFTb/2SdfE9TqU BMJ2tISYoAApUVsAl/qCVN5xGZ0hAk8nCNWEe6UW4ZWTEK9UyYjf7vVkRzaJXw== From: Miquel Raynal To: Alexander Aring , Stefan Schmidt , linux-wpan@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , netdev@vger.kernel.org, David Girault , Romuald Despres , Frederic Blain , Nicolas Schodet , Thomas Petazzoni , Miquel Raynal Subject: [PATCH wpan/next] net: mac802154: Avoid displaying misleading debug information Date: Mon, 5 Sep 2022 22:27:24 +0200 Message-Id: <20220905202724.1322046-1-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org With DEBUG defined, any frame received will see its MHR fields (fc and addresses, mainly) being printed in the kernel log buffer, unconditionally. In most cases this is fine, but in some specific cases (like Acknowledgment frames, where both the source and destination addressing fields are omitted), it displays garbage which is misleading. Only print the addressing fields when they are present, which clarifies the logs. Signed-off-by: Miquel Raynal --- net/mac802154/rx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c index c439125ef2b9..c0fd8d0c7f03 100644 --- a/net/mac802154/rx.c +++ b/net/mac802154/rx.c @@ -114,8 +114,10 @@ ieee802154_subif_frame(struct ieee802154_sub_if_data *sdata, static void ieee802154_print_addr(const char *name, const struct ieee802154_addr *addr) { - if (addr->mode == IEEE802154_ADDR_NONE) + if (addr->mode == IEEE802154_ADDR_NONE) { pr_debug("%s not present\n", name); + return; + } pr_debug("%s PAN ID: %04x\n", name, le16_to_cpu(addr->pan_id)); if (addr->mode == IEEE802154_ADDR_SHORT) {