Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5651579img; Wed, 27 Mar 2019 12:28:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqxfWAE7evYQQTjYJx1RAM1PyNwT3Thp85iDgKfcyrOKNORYroJU55E5Ofbq2lGuNOahSxxK X-Received: by 2002:a65:420b:: with SMTP id c11mr14817423pgq.24.1553714910244; Wed, 27 Mar 2019 12:28:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553714910; cv=none; d=google.com; s=arc-20160816; b=UyVi7miOLwhocNWIeRLi02ClOXX1Ey0K9yoqlsg1Py+wSREbOtJNnzEGqlv0RABnI1 RkcL1UlgNhZxvwoej/RSiu7lxqt6lV9bp9yblDjmSB2bgQ0Q0VuOoOLJ/7+l/NbvXIcA 8ROElPawTz8bzd/oG1LGeve5mxRWDsS20nA+r649ryWH9ZgDaB4BRfjZ31NWBQVKHdis Zpd1t6YfKiqgKNGIcev/ERJTtHEsbETdutT43Fvn9wHiBW6mhNhPYleYxuF2b1CUkQh8 i3ZcXbFiO8Ip96Pia+mPpwa5+CDu/rgpH3rObPbJIF15kbm1BHi0gZx2vcgsYAJgmgHK Di2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=q6bS4hkLAlsbz+GxoLHkySqkuMxQTN8OEHztMwhyIVQ=; b=jmaEwArZQzHyB6GV62oQIc8ahcBrITfz0QPtQfm6tlfyff4wdZeG9Zpz7wIkgE6zaE fZ6iUqluowyVfrpk11IzmxoJNJU77RImmWfvQiv70iB9/qS8d04K15PEtBtpOVu6k+xo 18rVjoFe1Z59aMf3B0PeqPn3I/QjUJob0ReE7fcrhETNRyl2LKUoX+1Qlueg4dM1jZcx FPJjjNXNjlSg2AdbsinM+LM30rEhKnLJ6m4KwhkPG6G37/oH7gu7/IKFtcH3bltHj6tO hBlok3mpgh2iOOhPxNpXIRGzi/VFs/7/djZQY/DVa3JJmLOVVwOyABQXVG4QbD772f1W I43g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=czfOB71o; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v145si16094901pgb.16.2019.03.27.12.28.14; Wed, 27 Mar 2019 12:28:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=czfOB71o; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387544AbfC0SFC (ORCPT + 99 others); Wed, 27 Mar 2019 14:05:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:45916 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731922AbfC0SE7 (ORCPT ); Wed, 27 Mar 2019 14:04:59 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 749A92177E; Wed, 27 Mar 2019 18:04:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553709898; bh=p4xjUdC8xE4z8EFrgn8EKHuu1jf6IJ1PFkPcMSwc/Uk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=czfOB71ooXN1AabPWYtaT0WxlXfl9vSP0QVGPgW9KUN87yiUy2QoOzcpw/Q5/CFGl EESLK7LeuzmoBNwTAw1AF/d+s/vYK7tSDWZdm7hWGIGbg5FYAs5SJhq58wlJPPQILg pKtqRLqB6gvleOPtAiUoWoXdUVaaOH2UUhb7ZWYc= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Florian Fainelli , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.0 096/262] e1000e: Fix -Wformat-truncation warnings Date: Wed, 27 Mar 2019 13:59:11 -0400 Message-Id: <20190327180158.10245-96-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327180158.10245-1-sashal@kernel.org> References: <20190327180158.10245-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Florian Fainelli [ Upstream commit 135e7245479addc6b1f5d031e3d7e2ddb3d2b109 ] Provide precision hints to snprintf() since we know the destination buffer size of the RX/TX ring names are IFNAMSIZ + 5 - 1. This fixes the following warnings: drivers/net/ethernet/intel/e1000e/netdev.c: In function 'e1000_request_msix': drivers/net/ethernet/intel/e1000e/netdev.c:2109:13: warning: 'snprintf' output may be truncated before the last format character [-Wformat-truncation=] "%s-rx-0", netdev->name); ^ drivers/net/ethernet/intel/e1000e/netdev.c:2107:3: note: 'snprintf' output between 6 and 21 bytes into a destination of size 20 snprintf(adapter->rx_ring->name, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sizeof(adapter->rx_ring->name) - 1, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "%s-rx-0", netdev->name); ~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/ethernet/intel/e1000e/netdev.c:2125:13: warning: 'snprintf' output may be truncated before the last format character [-Wformat-truncation=] "%s-tx-0", netdev->name); ^ drivers/net/ethernet/intel/e1000e/netdev.c:2123:3: note: 'snprintf' output between 6 and 21 bytes into a destination of size 20 snprintf(adapter->tx_ring->name, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sizeof(adapter->tx_ring->name) - 1, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "%s-tx-0", netdev->name); ~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/e1000e/netdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 189f231075c2..23eae3df01a9 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -2106,7 +2106,7 @@ static int e1000_request_msix(struct e1000_adapter *adapter) if (strlen(netdev->name) < (IFNAMSIZ - 5)) snprintf(adapter->rx_ring->name, sizeof(adapter->rx_ring->name) - 1, - "%s-rx-0", netdev->name); + "%.14s-rx-0", netdev->name); else memcpy(adapter->rx_ring->name, netdev->name, IFNAMSIZ); err = request_irq(adapter->msix_entries[vector].vector, @@ -2122,7 +2122,7 @@ static int e1000_request_msix(struct e1000_adapter *adapter) if (strlen(netdev->name) < (IFNAMSIZ - 5)) snprintf(adapter->tx_ring->name, sizeof(adapter->tx_ring->name) - 1, - "%s-tx-0", netdev->name); + "%.14s-tx-0", netdev->name); else memcpy(adapter->tx_ring->name, netdev->name, IFNAMSIZ); err = request_irq(adapter->msix_entries[vector].vector, -- 2.19.1