From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: Re: [PATCH v6 15/16] app/test-bbdev: strcpy ok for allocated string Date: Mon, 14 May 2018 21:56:57 +0100 Message-ID: <79e0fc5e-d43a-bbe5-26f1-5fd4384ebb34@intel.com> References: <152627394448.52758.15834703911138407294.stgit@localhost.localdomain> <152627406736.52758.1036851396439121779.stgit@localhost.localdomain> <6b056fee-11a8-45d3-33e9-bb4c946cfc8f@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit To: Andy Green , dev@dpdk.org Return-path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 98E251C914 for ; Mon, 14 May 2018 22:56:59 +0200 (CEST) In-Reply-To: <6b056fee-11a8-45d3-33e9-bb4c946cfc8f@intel.com> Content-Language: en-US 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 5/14/2018 9:42 PM, Ferruh Yigit wrote: > On 5/14/2018 6:01 AM, Andy Green wrote: >> Signed-off-by: Andy Green >> Fixes: f714a18885a6 ("app/testbbdev: add test application for bbdev") >> Cc: stable@dpdk.org >> --- >> app/test-bbdev/test_bbdev_vector.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/app/test-bbdev/test_bbdev_vector.c b/app/test-bbdev/test_bbdev_vector.c >> index a37e35f4d..c574f2135 100644 >> --- a/app/test-bbdev/test_bbdev_vector.c >> +++ b/app/test-bbdev/test_bbdev_vector.c >> @@ -892,7 +892,7 @@ test_bbdev_vector_read(const char *filename, >> } >> >> memset(entry, 0, strlen(line) + 1); >> - strncpy(entry, line, strlen(line)); >> + strcpy(entry, line); > > agreed that according above code strcpy is OK but still why change it? Is this > fixing a build error? Yes: .../app/test-bbdev/test_bbdev_vector.c:895:3: error: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation] strncpy(entry, line, strlen(line)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >> >> /* check if entry ends with , or = */ >> if (entry[strlen(entry) - 1] == ',' >> >