Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp1146650imp; Thu, 21 Feb 2019 20:11:01 -0800 (PST) X-Google-Smtp-Source: AHgI3IbuE/2tk03okKLMPVNcE7bPWB04Q3KlaWWwXLvHbUJCGPg/NhWMoOtLBZNei2r3k0AVY9re X-Received: by 2002:a17:902:e90b:: with SMTP id cs11mr2069081plb.197.1550808661656; Thu, 21 Feb 2019 20:11:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550808661; cv=none; d=google.com; s=arc-20160816; b=lQC6nsUiY93WLdQxwVU+P0WU5IqnFuXZMdS/wmQGS2Qcebb3oC2adthCmtGtBWT8IO dCSGu+jKWuPGxi22DoyKYkJrprd79LORMQYfZ7Xk4VvZrD8pu8zZ1ZceNTc3FeGhmggv jhPM+bH8OzBf7dflLw6w4nnElvC/oVQARcVOZi+sovk4EXgahyDNtuY3hbkmUHBXQmoC vygOwfJ3rl+/fImVu2Bkxg3o8j/p24MlGLIs8KWvoJPyCaIQAchtZMnq1x4Cp3gsXehW x5n3OLkgilt3C4Iswlo1Zwi2hUl1Dg7R4DrApS4Jm27127h6yR/HjdBXgKuyiM5HCqYv Vc7g== 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=xtikp9Tj1v5uFbNmv3/WninwYjKrdcmWQFe4PZoP6es=; b=sVGn9IRw0sHfw10opUWmyS1IDYvjWEqDPOADXMYVF+mX28mTAhjAhyh77Epo/30a5l KiZPJSknGrMGOdFMcJNrFgyho1L63OujK9oEtuajxsBFf0EN2Yb53pG23IKNZ6WjRje3 +nHeMRQ5GgKMX+SqoqR/z+Eni+0IJwWSgN771nkat3xMYIUkD4HOq+T+g2K7awPdItIo NhIeM9sPfVvZCl/Vd38vJVcLQn9+PaxFswQLCdUeQbomVa5D4MCpS444S4BoS+qchHGA MC8625hBeLq0qtyvmPoyazQWHO+EugbEr/2r7+FaP8nBStWgAxQS4NgWqxnLoDon3LDT TPVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bIgWz7sq; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q15si355130pgm.420.2019.02.21.20.10.46; Thu, 21 Feb 2019 20:11:01 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=bIgWz7sq; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727003AbfBVEJz (ORCPT + 99 others); Thu, 21 Feb 2019 23:09:55 -0500 Received: from mail-oi1-f193.google.com ([209.85.167.193]:43850 "EHLO mail-oi1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726183AbfBVEJu (ORCPT ); Thu, 21 Feb 2019 23:09:50 -0500 Received: by mail-oi1-f193.google.com with SMTP id i8so716381oib.10; Thu, 21 Feb 2019 20:09:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xtikp9Tj1v5uFbNmv3/WninwYjKrdcmWQFe4PZoP6es=; b=bIgWz7sqcuy+hTXU/S1fsyRkWdm01MnqihM9Xl6G9HfGD5lHpG2yC/h0xoenby9l19 J0IQSaqYIinhXtkED13O7+PSpu+h43/00ly/apLb5B3OL3C8MNBf/hX8zyVj3cWPmm/a UZaudnolPF6swZW88bKP5EvQlVExesiGdOCQLDqImwqRTiIYiq5RKxjnW7jrjvT1oAUx Xjg3hm1Hlwc1ZOE1AjG6k3dS1TYJxmffsSCXW5A7z4oMJnWkhzSXpEm26nUVR8p8Nu3d K7O1vTlnpUzLJKeLRBZ+DygS83mFrh2D34inT8LIgg/C4Oi1rPCY/zIgE0sxKUvh/OEd +b2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xtikp9Tj1v5uFbNmv3/WninwYjKrdcmWQFe4PZoP6es=; b=W/M71p3hHFbsOSq4TdW6iTuWM1ZVJykGqDoJg4/6bRJrk1jZZ7cS8YBSdE7YYBq1NL YOBa0JcMGqnxiyFNwNFCUyhhb2DCrpNl6YgZtXQTIbO02Cxs2QTueLgRsd1+cX9C7HfB TyUkcnrd3BpUcZJsDCq59L6zzLr35sxnWwRaI4A3SadOKQXRA8SoXtHpTR0giffx7Cnb viCey9vz36b13eGHjaW3EkhvfcSDEG/uEBjO+OUQyi5ByKGtwQo4I9fkl+x3vQBzCHiz RF+yl9po2TRNBjxjZG24B5tESqYmAIesaXJYR7pxgcPtJCXItuBjQ3KwGhc+wtH0Upt9 ljpw== X-Gm-Message-State: AHQUAuZjIrPnLjIDSeeDpuQ/VNMzNiPljOR83jyg+tdL/WaAmLx2X0QU 0JQfK9jtuFvVgCCs+gVXoM7cCkmQ X-Received: by 2002:aca:7503:: with SMTP id q3mr1262494oic.76.1550808589396; Thu, 21 Feb 2019 20:09:49 -0800 (PST) Received: from localhost.localdomain (ip68-228-73-187.oc.oc.cox.net. [68.228.73.187]) by smtp.gmail.com with ESMTPSA id r1sm167836otk.48.2019.02.21.20.09.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Feb 2019 20:09:48 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Cc: davem@davemloft.net, Florian Fainelli , Jeff Kirsher , intel-wired-lan@lists.osuosl.org (moderated list:INTEL ETHERNET DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 3/4] e1000e: Fix -Wformat-truncation warnings Date: Thu, 21 Feb 2019 20:09:28 -0800 Message-Id: <20190222040929.16657-4-f.fainelli@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190222040929.16657-1-f.fainelli@gmail.com> References: <20190222040929.16657-1-f.fainelli@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 736fa51878f8..7acc61e4f645 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