From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDE01C3A59F for ; Sat, 31 Aug 2019 08:49:32 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id 9C6B223711 for ; Sat, 31 Aug 2019 08:49:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9C6B223711 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org 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 > >