linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Huazhong Tan <tanhuazhong@huawei.com>
To: <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<salil.mehta@huawei.com>, <yisen.zhuang@huawei.com>,
	<linuxarm@huawei.com>, <jakub.kicinski@netronome.com>,
	Guojia Liao <liaoguojia@huawei.com>,
	"Huazhong Tan" <tanhuazhong@huawei.com>
Subject: [PATCH net-next 5/9] net: hns3: cleanup a format-truncation warning
Date: Thu, 31 Oct 2019 19:23:20 +0800	[thread overview]
Message-ID: <1572521004-36126-6-git-send-email-tanhuazhong@huawei.com> (raw)
In-Reply-To: <1572521004-36126-1-git-send-email-tanhuazhong@huawei.com>

From: Guojia Liao <liaoguojia@huawei.com>

In hns3_nic_init_irq(), when '*_int_idx' has more than 9 digits
and the length of netdev's name is IFNAMSIZ, the total length
of final name will be bigger the HNAE3_INT_NAME_LEN - 1, even
though '*_int_idx' will never have such large value, but the
compiler gives a format-truncation warning for this case.

So this patch just enlarges the length to avoid this warning.

Signed-off-by: Guojia Liao <liaoguojia@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hnae3.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
index 23478ee..45f5916 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
@@ -575,7 +575,8 @@ struct hnae3_ae_algo {
 	const struct pci_device_id *pdev_id_table;
 };
 
-#define HNAE3_INT_NAME_LEN        (IFNAMSIZ + 16)
+#define HNAE3_INT_NAME_EXT_LEN    32	 /* Max extra information length */
+#define HNAE3_INT_NAME_LEN        (IFNAMSIZ + HNAE3_INT_NAME_EXT_LEN)
 #define HNAE3_ITR_COUNTDOWN_START 100
 
 struct hnae3_tc_info {
-- 
2.7.4


  parent reply	other threads:[~2019-10-31 11:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-31 11:23 [PATCH net-next 0/9] net: hns3: add some optimizations ane cleanups Huazhong Tan
2019-10-31 11:23 ` [PATCH net-next 1/9] net: hns3: dump some debug information when reset fail Huazhong Tan
2019-10-31 11:23 ` [PATCH net-next 2/9] net: hns3: add struct netdev_queue debug info for TX timeout Huazhong Tan
2019-10-31 11:23 ` [PATCH net-next 3/9] net: hns3: cleanup some magic numbers Huazhong Tan
2019-10-31 11:23 ` [PATCH net-next 4/9] net: hns3: cleanup some coding style issues Huazhong Tan
2019-10-31 11:23 ` Huazhong Tan [this message]
2019-10-31 11:23 ` [PATCH net-next 6/9] net: hns3: optimize local variable initialization Huazhong Tan
2019-10-31 11:23 ` [PATCH net-next 7/9] net: hns3: add or modify some comments Huazhong Tan
2019-10-31 11:23 ` [PATCH net-next 8/9] net: hns3: cleanup some print format warning Huazhong Tan
2019-10-31 11:53   ` Joe Perches
2019-11-01  1:17     ` tanhuazhong
2019-10-31 11:23 ` [PATCH net-next 9/9] net: hns3: cleanup byte order issues when printed Huazhong Tan
2019-10-31 19:03 ` [PATCH net-next 0/9] net: hns3: add some optimizations ane cleanups David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1572521004-36126-6-git-send-email-tanhuazhong@huawei.com \
    --to=tanhuazhong@huawei.com \
    --cc=davem@davemloft.net \
    --cc=jakub.kicinski@netronome.com \
    --cc=liaoguojia@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=salil.mehta@huawei.com \
    --cc=yisen.zhuang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).