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 22:01:09 +0100 Message-ID: <4f3189e9-274d-718e-1256-711a6521b8ce@intel.com> References: <152627394448.52758.15834703911138407294.stgit@localhost.localdomain> <152627406736.52758.1036851396439121779.stgit@localhost.localdomain> <6b056fee-11a8-45d3-33e9-bb4c946cfc8f@intel.com> <79e0fc5e-d43a-bbe5-26f1-5fd4384ebb34@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 mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 537411C914 for ; Mon, 14 May 2018 23:01:13 +0200 (CEST) In-Reply-To: <79e0fc5e-d43a-bbe5-26f1-5fd4384ebb34@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:56 PM, Ferruh Yigit wrote: > On 5/14/2018 9:42 PM, Ferruh Yigit wrote: >> On 5/14/2018 6:01 AM, Andy Green wrote: >>> Fixes: f714a18885a6 ("app/testbbdev: add test application for bbdev") >>> Cc: stable@dpdk.org >>> Signed-off-by: Andy Green Reviewed-by: Ferruh Yigit >>> --- >>> 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] == ',' >>> >> >