From patchwork Sun Jul 23 04:04:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dongliang Mu X-Patchwork-Id: 124419 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp1096788vqg; Sat, 22 Jul 2023 21:40:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlGVdBDuhXuMKGNBZfw9QOIBa89R1xS1UmnUy//lIrEkIKunWDgUHIS2DGg/F+F8TXhO65dQ X-Received: by 2002:aa7:c0cb:0:b0:522:21a1:4245 with SMTP id j11-20020aa7c0cb000000b0052221a14245mr1117351edp.27.1690087215538; Sat, 22 Jul 2023 21:40:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690087215; cv=none; d=google.com; s=arc-20160816; b=DTj0JXkxuF1NMyHxRIvvz10jlFHITDLLysl/PWt6ouro43aAksdDcPZnJMtMiPyEA0 3H8qhbbG4Y+JLeLVqQjoGjkn8vzMErC7zrLbXt+JNAf9S+t931B+xLbdIsKZDv4/3205 tJEElKc0oHZkzcfPVFvOeUDxslJp5sGUAOhdMD4Qgs4hXVs9lIkZ8V/42jzQuflQcxKX 13UVoxRWwniGm9F+C7xGQT+QUS47viXWJ72Ka92omy85Wg1oU8/nVF7j8azwUcY0I93Z YQx8CK0Nu3ojj+LPVhedb1Cx2mqv1PtVYjsUo6g7lbqEZzVd1xdVS24sFCxcn0Jn7RJy Z+jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=ILpNg3BNxSTyAGn6xY3uWc1fNymrk0vFhLy5Ki7Bpvg=; fh=gO693ysgJfRulKfbmw7tTxOng7NqOQZxUW+7GzpAQg8=; b=QfKzvD0pOwNqmttRa8LAzmSD5UTSk5GmV/vixqzEeVuKKKTNCZYgVGlg9vNFBU0Pnm 0c39CEhWBv5sdITkJo50a5HwD3uVXh/ChZSayVjtfreSqnfaRVGUMUMK0v8kqVEhonN3 tyFtNonHrjFtfGl4TDJVTNeLS3XGudKTeYehGKvSXMFSmDSyDlIFMY0m5wEkBtnFQ+bd zCdF3xrP7XShkadHy0EM9yI7s3CCKm3OIITdmImEI+7UShqggeZjsbBV70fvfVE9gDZY d1MfAyOnZbQ3N9Pl3AYwd/DsgSjbSNV+L3a4pVRb8L6k1NzUvjD5VRgR1N0jAolTfC69 AlLw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e9-20020a056402148900b0051e472af82asi4746465edv.209.2023.07.22.21.39.52; Sat, 22 Jul 2023 21:40:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229656AbjGWEEx (ORCPT + 99 others); Sun, 23 Jul 2023 00:04:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229553AbjGWEEv (ORCPT ); Sun, 23 Jul 2023 00:04:51 -0400 Received: from hust.edu.cn (unknown [202.114.0.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B1BB1BE4; Sat, 22 Jul 2023 21:04:49 -0700 (PDT) Received: from localhost.localdomain ([172.16.0.254]) (user=dzm91@hust.edu.cn mech=LOGIN bits=0) by mx1.hust.edu.cn with ESMTP id 36N448BH007453-36N448BI007453 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Sun, 23 Jul 2023 12:04:13 +0800 From: Dongliang Mu To: =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , Kalle Valo Cc: Dongliang Mu , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4] wifi: ath9k: fix printk specifier Date: Sun, 23 Jul 2023 12:04:02 +0800 Message-Id: <20230723040403.296723-1-dzm91@hust.edu.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-FEAS-AUTH-USER: dzm91@hust.edu.cn X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772184891893222293 X-GMAIL-MSGID: 1772184891893222293 Smatch reports: ath_pci_probe() warn: argument 4 to %lx specifier is cast from pointer ath_ahb_probe() warn: argument 4 to %lx specifier is cast from pointer Fix it by modifying %lx to %p in the printk format string. Note that with this change, the pointer address will be printed as a hashed value by default. This is appropriate because the kernel should not leak kernel pointers to user space in an informational message. If someone wants to see the real address for debugging purposes, this can be achieved with the no_hash_pointers kernel option. Signed-off-by: Dongliang Mu Acked-by: Toke Høiland-Jørgensen --- v3->v4: add the explanation about why this commit uses %p v2->v3: modify %px to %p in the patch v1->v2: modify %px to %p in the commit message drivers/net/wireless/ath/ath9k/ahb.c | 4 ++-- drivers/net/wireless/ath/ath9k/pci.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/ahb.c b/drivers/net/wireless/ath/ath9k/ahb.c index 9cd12b20b18d..9bfaadfa6c00 100644 --- a/drivers/net/wireless/ath/ath9k/ahb.c +++ b/drivers/net/wireless/ath/ath9k/ahb.c @@ -132,8 +132,8 @@ static int ath_ahb_probe(struct platform_device *pdev) ah = sc->sc_ah; ath9k_hw_name(ah, hw_name, sizeof(hw_name)); - wiphy_info(hw->wiphy, "%s mem=0x%lx, irq=%d\n", - hw_name, (unsigned long)mem, irq); + wiphy_info(hw->wiphy, "%s mem=0x%p, irq=%d\n", + hw_name, mem, irq); return 0; diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c index a09f9d223f3d..0633589b85c2 100644 --- a/drivers/net/wireless/ath/ath9k/pci.c +++ b/drivers/net/wireless/ath/ath9k/pci.c @@ -988,8 +988,8 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) sc->sc_ah->msi_reg = 0; ath9k_hw_name(sc->sc_ah, hw_name, sizeof(hw_name)); - wiphy_info(hw->wiphy, "%s mem=0x%lx, irq=%d\n", - hw_name, (unsigned long)sc->mem, pdev->irq); + wiphy_info(hw->wiphy, "%s mem=0x%p, irq=%d\n", + hw_name, sc->mem, pdev->irq); return 0;