From patchwork Fri Jan 17 18:37:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 13943839 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 327011E0B7C for ; Fri, 17 Jan 2025 18:37:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737139049; cv=none; b=NmxtPzlm8JgknX4Iv5dc5p1NA24fVGDT+h4Awv+mUHLjVmlDGpD6VghB2Kshbhmdkl1riPBifTSV3n9aRU4dyM/yXQvJIE1RuphKvFyNoTQmkofzTA4A39/oYlxV+umhrCubXP0/26tu7puJYVGZF8zpz2tkBZh9ilvCR1qfqeE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737139049; c=relaxed/simple; bh=l+nz8xkxsiWSzzT8l7gVtxCih4qgZhIsv1z4ibKvQik=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=XKrBW0xCnO1K5HZL48hMNVjdViSDYQvC+W1Quepyp2SW59Ss56dyMR1deSJZNtS/atGKfuxhgMIa8qLXap2Vv6Pxpmqk0akGIG6VMgrwGX+F1kj5tmFAdZPEuJZ+Ze/Yoj/tJpdQ9jn2uKghl/AJ34ltpJ54ZFBKIKGHiGWBHCM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=X1dSRLEL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="X1dSRLEL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54C2CC4CEE0; Fri, 17 Jan 2025 18:37:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737139048; bh=l+nz8xkxsiWSzzT8l7gVtxCih4qgZhIsv1z4ibKvQik=; h=From:To:Cc:Subject:Date:From; b=X1dSRLELjFGeoyBUPVs2JmchVPcDVyVo4fqIA74X7BJyGMRqGg6aYlUvSoUCtW2xi DAPu80yvfdcYujqRCvu8y4Ixih1FLpKQHXh/es4RCDL4OJ0/8kjcxvP+fwGvZpx2zX qa3oAxXQ4RtRCdhQJ0uxIcoOqL0njVtaOQDwihILlF0i0pvNs/jzzkFVZu/7HzHvXN SHgVx1kGux0f2nAQpi+JyCYBl3UKAGCOlPNKAnGxKKergx+eqgQ6rd2d0fpWSyrEAN ZP5Mb8JNksotF70pNGQCZCIBnSF5+oso+4wuwtMK3Y/3yOZIZG9t42ipg/f/dLdblm 9TswTpNWvnZjQ== From: Jakub Kicinski To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org, Jakub Kicinski , michael.chan@broadcom.com, pavan.chebbi@broadcom.com Subject: [PATCH net-next] eth: bnxt: fix string truncation warning in FW version Date: Fri, 17 Jan 2025 10:37:26 -0800 Message-ID: <20250117183726.1481524-1-kuba@kernel.org> X-Mailer: git-send-email 2.48.1 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org W=1 builds with gcc 14.2.1 report: drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c:4193:32: error: ā€˜%sā€™ directive output may be truncated writing up to 31 bytes into a region of size 27 [-Werror=format-truncation=] 4193 | "/pkg %s", buf); It's upset that we let buf be full length but then we use 5 characters for "/pkg ". The builds is also clear with clang version 19.1.5 now. Signed-off-by: Jakub Kicinski Reviewed-by: Michael Chan --- CC: michael.chan@broadcom.com CC: pavan.chebbi@broadcom.com --- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index 540c140d52dc..65a20931c579 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -4184,7 +4184,7 @@ int bnxt_get_pkginfo(struct net_device *dev, char *ver, int size) static void bnxt_get_pkgver(struct net_device *dev) { struct bnxt *bp = netdev_priv(dev); - char buf[FW_VER_STR_LEN]; + char buf[FW_VER_STR_LEN - 5]; int len; if (!bnxt_get_pkginfo(dev, buf, sizeof(buf))) {