From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 928B2A0613 for ; Sat, 31 Aug 2019 10:49:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 78BA81EAAD; Sat, 31 Aug 2019 10:49:31 +0200 (CEST) Received: from huawei.com (szxga05-in.huawei.com [45.249.212.191]) by dpdk.org (Postfix) with ESMTP id 7E1FF1EA8D for ; Sat, 31 Aug 2019 10:49:29 +0200 (CEST) Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 60AD2CD17FC386DCBDF0; Sat, 31 Aug 2019 16:49:28 +0800 (CST) Received: from [127.0.0.1] (10.57.115.182) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.439.0; Sat, 31 Aug 2019 16:49:18 +0800 To: Ferruh Yigit , References: <1566568031-45991-1-git-send-email-xavier.huwei@huawei.com> <1566568031-45991-20-git-send-email-xavier.huwei@huawei.com> <13ad540e-ca60-e304-352b-b33ca1ebb6ea@intel.com> CC: , , , From: "Wei Hu (Xavier)" Message-ID: <9a1d568e-5993-3204-a467-047e39c116ef@huawei.com> Date: Sat, 31 Aug 2019 16:49:17 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <13ad540e-ca60-e304-352b-b33ca1ebb6ea@intel.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.57.115.182] X-CFilter-Loop: Reflected Subject: Re: [dpdk-dev] [PATCH 19/22] net/hns3: add stats related ops for hns3 PMD driver X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 2019/8/30 23:20, Ferruh Yigit wrote: > On 8/23/2019 2:47 PM, Wei Hu (Xavier) wrote: >> This patch adds stats_get, stats_reset, xstats_get, xstats_get_names >> xstats_reset, xstats_get_by_id and xstats_get_names_by_id related >> function codes. >> >> Signed-off-by: Wei Hu (Xavier) >> Signed-off-by: Hao Chen >> Signed-off-by: Chunsong Feng >> Signed-off-by: Min Hu (Connor) >> Signed-off-by: Huisong Li > <...> > >> + for (i = 0; i < size; i++) { >> + if (ids[i] >= cnt_stats) { >> + PMD_INIT_LOG(ERR, "id value is invalid"); >> + return -EINVAL; >> + } >> + strncpy(xstats_names[i].name, xstats_names_copy[ids[i]].name, >> + strlen(xstats_names_copy[ids[i]].name)); > Getting following warning from this line: > > .../drivers/net/hns3/hns3_stats.c: In function > ‘hns3_dev_xstats_get_names_by_id’: > > .../drivers/net/hns3/hns3_stats.c:825:3: error: ‘strncpy’ output truncated > before terminating nul copying as many bytes from a string as its length > [-Werror=stringop-truncation] > 825 | strncpy(xstats_names[i].name, xstats_names_copy[ids[i]].name, > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 826 | strlen(xstats_names_copy[ids[i]].name)); > > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Hi, Ferruh Yigit Thanks for your comments, We will fix it in patch V2. Regards Xavier > >