Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1025603yba; Thu, 4 Apr 2019 02:42:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqxnYg806B0dNoeRllRBZSePkoBa0qaEixkAeWjeBfuD8mCN9vHpihOQdweR8OFgyXjvtp0A X-Received: by 2002:a62:4754:: with SMTP id u81mr4794086pfa.66.1554370957074; Thu, 04 Apr 2019 02:42:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554370957; cv=none; d=google.com; s=arc-20160816; b=zWe7qlHYvC98r8VLARR7qLQikM1C7yM3L3uV52LjshdL0YvvJ+dIL6+HDEAAgVaaTP zGNz3tX6PVVYI11qpmf8LSUxT50OcMpp3o6joYT56knkF/eAXnz/j5DvjThgzycJA1P/ sMT3Rex1KE6Yi4h8gREeZeHhB7C1Z8AHnGnmmeryPk3CJiJJOqq8j+GODx61pVFTGTrT xW1Uec7gNQ3jAs0ea1OZB1Mw6AE/OPunZOBeiWtjSqKYerEeK15Mpkown99fxHa4L7b5 2B/+VFiX/0fMjUIzZWPI3mnwSqRUafhl0BF3hOO9WccJ6Ckl+zuNs7l/i6WUywbZhOjp a0vg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1/93UqA/M678ObuTNjHYvKm9XqvbArrxhOb3wqa1EYk=; b=UA2fKNLrkhTq19glDPwCrVfQFXHRFpr3cfZ1e1arqjsTr+V7BCOQVyrp2U60nxseZV SLvoycYhqH2XaLKO9sAVt4qturNueEoXmqc5wb4FY3gPzt13GJV88C+xqpC5DWNicHSo Khh6nQ3ZIo5bFQyBJG4AZlcKUKM+E0gf3Kv7gGpNxWrn9HaEeIt9qM73HCCG2shyRcug /of1xu79SMTSIb5/Ay19Nh5ZW3/krXD5A58BiHyLwNFbF5dvzHiyv1AZrB2mQV5juL2+ +NI2TGlptKbUZJteP1+bj5MPLvWC6Hw9A/qvFHZuYY8I9NbpAB057UWnq9e5P3oCOsqx 9xOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tk0gcQBM; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d92si611656pld.100.2019.04.04.02.42.21; Thu, 04 Apr 2019 02:42:37 -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=tk0gcQBM; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731506AbfDDJBx (ORCPT + 99 others); Thu, 4 Apr 2019 05:01:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:39082 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731493AbfDDJBv (ORCPT ); Thu, 4 Apr 2019 05:01:51 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2344A2147C; Thu, 4 Apr 2019 09:01:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554368510; bh=I2QDmcozZkWN7ngFiPiJpwPdvxcXMk91BkmYyiUw6HU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tk0gcQBMi3Ju5q4IrWy+EKI81vOBoA3gPKS/nFi2rrA5IlogEe2k74v/wX9e6sO8f pb3IPz5xGlvBR5eavxz3tvs1vwczIPrbVV4f1L2pWFzsCorxi9R5tJKqDeM73pC7Hk 2vyMIo5FXqTJuOMcVSJPjLCYlcnsabPk/sl88oew= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , Ido Schimmel , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 066/187] mlxsw: spectrum: Avoid -Wformat-truncation warnings Date: Thu, 4 Apr 2019 10:46:43 +0200 Message-Id: <20190404084606.160318303@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190404084603.119654039@linuxfoundation.org> References: <20190404084603.119654039@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit ab2c4e2581ad32c28627235ff0ae8c5a5ea6899f ] Give precision identifiers to the two snprintf() formatting the priority and TC strings to avoid producing these two warnings: drivers/net/ethernet/mellanox/mlxsw/spectrum.c: In function 'mlxsw_sp_port_get_prio_strings': drivers/net/ethernet/mellanox/mlxsw/spectrum.c:2132:37: warning: '%d' directive output may be truncated writing between 1 and 3 bytes into a region of size between 0 and 31 [-Wformat-truncation=] snprintf(*p, ETH_GSTRING_LEN, "%s_%d", ^~ drivers/net/ethernet/mellanox/mlxsw/spectrum.c:2132:3: note: 'snprintf' output between 3 and 36 bytes into a destination of size 32 snprintf(*p, ETH_GSTRING_LEN, "%s_%d", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mlxsw_sp_port_hw_prio_stats[i].str, prio); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/ethernet/mellanox/mlxsw/spectrum.c: In function 'mlxsw_sp_port_get_tc_strings': drivers/net/ethernet/mellanox/mlxsw/spectrum.c:2143:37: warning: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size between 0 and 31 [-Wformat-truncation=] snprintf(*p, ETH_GSTRING_LEN, "%s_%d", ^~ drivers/net/ethernet/mellanox/mlxsw/spectrum.c:2143:3: note: 'snprintf' output between 3 and 44 bytes into a destination of size 32 snprintf(*p, ETH_GSTRING_LEN, "%s_%d", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mlxsw_sp_port_hw_tc_stats[i].str, tc); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Florian Fainelli Reviewed-by: Ido Schimmel Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index a12b5710891e..f9bef030ee05 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -1988,7 +1988,7 @@ static void mlxsw_sp_port_get_prio_strings(u8 **p, int prio) int i; for (i = 0; i < MLXSW_SP_PORT_HW_PRIO_STATS_LEN; i++) { - snprintf(*p, ETH_GSTRING_LEN, "%s_%d", + snprintf(*p, ETH_GSTRING_LEN, "%.29s_%.1d", mlxsw_sp_port_hw_prio_stats[i].str, prio); *p += ETH_GSTRING_LEN; } @@ -1999,7 +1999,7 @@ static void mlxsw_sp_port_get_tc_strings(u8 **p, int tc) int i; for (i = 0; i < MLXSW_SP_PORT_HW_TC_STATS_LEN; i++) { - snprintf(*p, ETH_GSTRING_LEN, "%s_%d", + snprintf(*p, ETH_GSTRING_LEN, "%.29s_%.1d", mlxsw_sp_port_hw_tc_stats[i].str, tc); *p += ETH_GSTRING_LEN; } -- 2.19.1