Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp328146rdg; Thu, 12 Oct 2023 06:59:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFKOF588lsL2xbKwo0KJ/ibYrSZEtzPbNzyw5qhTRoQkFLL4gCiSMvimsEh5KsU3Kki1jW9 X-Received: by 2002:a17:902:c3cd:b0:1c6:1cd8:5b59 with SMTP id j13-20020a170902c3cd00b001c61cd85b59mr23252005plj.1.1697119152435; Thu, 12 Oct 2023 06:59:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697119152; cv=none; d=google.com; s=arc-20160816; b=jdQwrKSeufndmAZmP/XVh3GphZtE0hgJeP1cvAN/CFI9l9+YUG5PwyCWDMQ+pER/d6 z/T/niRC/hrcxzP/f/MpUWHpgX2j56fQvs4hXYCANuYFA7ITX7/uu9/VnF9lZ5bQ/BeI BDAtsl6HXZ/I8ZxbY2aYq3jo0S2h4ZIr1aLTh91YjlaRmvKDdG+LBDxdiXpGWyqeV3tJ Py6qRKAPQ+bX8XqeBofCTenay+uR2gWAMq94NTZh0qifrobnyA0BV/BaRBZCaAL/YayZ WKRQweOgPtVcN+eyJwPrLEjjQwW6Sstc0KTrbR4e+X5miCNJAWdVbAoO6VLzPikrnMad 3vNw== 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 :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=A6Le9gD1kXIJU34QuatifBHdpwIP2YckybkLMhTB97w=; fh=qW0phhq3fb3oiohK/Mu9j1KY1zyRNiiioKFc5anvatM=; b=DQM7aLFzyusnRH0Mof7nhaWFHFzfOuXseh8aXLiuw7x0Y3uc8c7gL2UPVAM1Y1broL ePz1T48Y3SX15qp4acWYbjP3VMNMrOvYrL9jER69JVkp2P8w1vsuGZ7w0v6x65cUMrCd KQXDRNubjk0IW7XgpHkMPP/ouo6qomVPHfCvPFYVkg/LKnj9NA/K42LkoMpJKSsJOCNx +UtTD5zkIfAQdOeAz1UW2Tq4IboBV3y2gIslcCn8zK2i2rLsuzbQOBvS3ES/MnBVkTqp zMBfG3WhWD6akcz+vBqXqd8lEuPMgrcovOdEgxFXWVYcS27uj0UYSifCTRquOlCOWYTM onuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XTKB8KRd; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id p7-20020a170902e74700b001c9d7d8860fsi2541615plf.485.2023.10.12.06.59.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 06:59:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XTKB8KRd; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 153C7822B2F4; Thu, 12 Oct 2023 06:59:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235121AbjJLN7B (ORCPT + 52 others); Thu, 12 Oct 2023 09:59:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379110AbjJLN67 (ORCPT ); Thu, 12 Oct 2023 09:58:59 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F10BB8 for ; Thu, 12 Oct 2023 06:58:58 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72AE2C433CA for ; Thu, 12 Oct 2023 13:58:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697119137; bh=cHOTseFbAfjWR5oKSR/XiH3SiuVSV0ZA/i/AQo2UWKk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=XTKB8KRdJya0HkrLNc6OeuL+4cDjAJcmZQhyallaYrk4AFEwfeuGXGKChLSrkhrl5 9xuqARy5zQIY0eKpwR6SsTMTVKbI9Nq4vE5QgkbF1rG8L+yhSSXiDLLehE15Fsq1Hx SNaL/3HE0lcmsN0ZWMXFCjGLGixzV1x3Hf/zyIBVgvROlA3wdZhDzLyjz7goYktQix 415QQAcTfxakVdzLrQfG41gviuYFgYc7y/PcCs1+1arUj0zYd4+VttPr+ArvYc8+qP RxwLX1w6EZdTv546KwQLxAsJ1BaqYZT0ZU3RTd56mGYG8xh0NTx4QGm3bBVCLcl62z gnEvdSLRu3TaQ== From: Kalle Valo To: linux-wireless@vger.kernel.org Subject: [PATCH 2/3] wifi: ipw2x00: fix format-truncation warnings Date: Thu, 12 Oct 2023 16:58:53 +0300 Message-Id: <20231012135854.3473332-2-kvalo@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231012135854.3473332-1-kvalo@kernel.org> References: <20231012135854.3473332-1-kvalo@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 12 Oct 2023 06:59:08 -0700 (PDT) On v6.6-rc4 with GCC 13.2 I see: drivers/net/wireless/intel/ipw2x00/ipw2100.c:5905:63: warning: '%s' directive output may be truncated writing up to 63 bytes into a region of size 32 [-Wformat-truncation=] drivers/net/wireless/intel/ipw2x00/ipw2100.c:5905:9: note: 'snprintf' output between 4 and 140 bytes into a destination of size 32 drivers/net/wireless/intel/ipw2x00/ipw2200.c:10392:63: warning: '%s' directive output may be truncated writing up to 63 bytes into a region of size 32 [-Wformat-truncation=] drivers/net/wireless/intel/ipw2x00/ipw2200.c:10392:9: note: 'snprintf' output between 4 and 98 bytes into a destination of size 32 Fix this by copying only the firmware version and not providing any extra information via ethtool. This is an ancient driver anyway and most likely removed soon so it doesn't really matter. Compile tested only. Signed-off-by: Kalle Valo --- drivers/net/wireless/intel/ipw2x00/ipw2100.c | 20 ++------------------ drivers/net/wireless/intel/ipw2x00/ipw2200.c | 6 +----- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2100.c b/drivers/net/wireless/intel/ipw2x00/ipw2100.c index 0812db8936f1..b6636002c7d2 100644 --- a/drivers/net/wireless/intel/ipw2x00/ipw2100.c +++ b/drivers/net/wireless/intel/ipw2x00/ipw2100.c @@ -317,8 +317,6 @@ static int ipw2100_get_firmware(struct ipw2100_priv *priv, struct ipw2100_fw *fw); static int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf, size_t max); -static int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf, - size_t max); static void ipw2100_release_firmware(struct ipw2100_priv *priv, struct ipw2100_fw *fw); static int ipw2100_ucode_download(struct ipw2100_priv *priv, @@ -5894,17 +5892,14 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { struct ipw2100_priv *priv = libipw_priv(dev); - char fw_ver[64], ucode_ver[64]; + char fw_ver[64]; strscpy(info->driver, DRV_NAME, sizeof(info->driver)); strscpy(info->version, DRV_VERSION, sizeof(info->version)); ipw2100_get_fwversion(priv, fw_ver, sizeof(fw_ver)); - ipw2100_get_ucodeversion(priv, ucode_ver, sizeof(ucode_ver)); - - snprintf(info->fw_version, sizeof(info->fw_version), "%s:%d:%s", - fw_ver, priv->eeprom_version, ucode_ver); + strscpy(info->fw_version, fw_ver, sizeof(info->fw_version)); strscpy(info->bus_info, pci_name(priv->pci_dev), sizeof(info->bus_info)); } @@ -8406,17 +8401,6 @@ static int ipw2100_get_fwversion(struct ipw2100_priv *priv, char *buf, return tmp; } -static int ipw2100_get_ucodeversion(struct ipw2100_priv *priv, char *buf, - size_t max) -{ - u32 ver; - u32 len = sizeof(ver); - /* microcode version is a 32 bit integer */ - if (ipw2100_get_ordinal(priv, IPW_ORD_UCODE_VERSION, &ver, &len)) - return -EIO; - return snprintf(buf, max, "%08X", ver); -} - /* * On exit, the firmware will have been freed from the fw list */ diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2200.c b/drivers/net/wireless/intel/ipw2x00/ipw2200.c index 820100cac491..902a772f4649 100644 --- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c @@ -10378,7 +10378,6 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev, { struct ipw_priv *p = libipw_priv(dev); char vers[64]; - char date[32]; u32 len; strscpy(info->driver, DRV_NAME, sizeof(info->driver)); @@ -10386,11 +10385,8 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev, len = sizeof(vers); ipw_get_ordinal(p, IPW_ORD_STAT_FW_VERSION, vers, &len); - len = sizeof(date); - ipw_get_ordinal(p, IPW_ORD_STAT_FW_DATE, date, &len); - snprintf(info->fw_version, sizeof(info->fw_version), "%s (%s)", - vers, date); + strscpy(info->fw_version, vers, sizeof(info->fw_version)); strscpy(info->bus_info, pci_name(p->pci_dev), sizeof(info->bus_info)); } -- 2.39.2