From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 7C83E2BD3 for ; Wed, 3 Oct 2018 09:48:16 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Oct 2018 00:48:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,335,1534834800"; d="scan'208";a="78306229" Received: from fyigit-mobl.ger.corp.intel.com (HELO [10.237.221.49]) ([10.237.221.49]) by orsmga008.jf.intel.com with ESMTP; 03 Oct 2018 00:48:12 -0700 To: Ye Xiaolong Cc: dev@dpdk.org, Maxime Coquelin , Tiwei Bie , Zhihong Wang , xiao.w.wang@intel.com, Rami Rosen , Wang Haiyue References: <20180928112344.42791-1-xiaolong.ye@intel.com> <20180928214747.48938-1-xiaolong.ye@intel.com> <20180928214747.48938-3-xiaolong.ye@intel.com> <20181003060420.GC78385@intel.com> From: Ferruh Yigit Openpgp: preference=signencrypt Message-ID: <621e5389-64c3-0311-3baf-45d5112430f6@intel.com> Date: Wed, 3 Oct 2018 08:48:12 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181003060420.GC78385@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v8 2/2] examples/vdpa: introduce a new sample for vDPA 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: , X-List-Received-Date: Wed, 03 Oct 2018 07:48:17 -0000 On 10/3/2018 7:04 AM, Ye Xiaolong wrote: > Hi, Ferruh, > > On 10/02, Ferruh Yigit wrote: >> On 9/28/2018 10:47 PM, Xiaolong Ye wrote: >>> The vdpa sample application creates vhost-user sockets by using the >>> vDPA backend. vDPA stands for vhost Data Path Acceleration which utilizes >>> virtio ring compatible devices to serve virtio driver directly to enable >>> datapath acceleration. As vDPA driver can help to set up vhost datapath, >>> this application doesn't need to launch dedicated worker threads for vhost >>> enqueue/dequeue operations. >>> >>> Signed-off-by: Xiaolong Ye >>> Acked-by: Xiao Wang >>> Reviewed-by: Maxime Coquelin >> >> <...> >> >>> +static int >>> +parse_args(int argc, char **argv) >>> +{ >>> + static const char *short_option = "i"; >>> + static struct option long_option[] = { >>> + {"iface", required_argument, NULL, 0}, >>> + {"interactive", no_argument, &interactive, 1}, >>> + {"client", no_argument, &client_mode, 1}, >>> + {NULL, 0, 0, 0}, >>> + }; >>> + int opt, idx; >>> + char *prgname = argv[0]; >>> + >>> + while ((opt = getopt_long(argc, argv, short_option, long_option, &idx)) >>> + != EOF) { >>> + switch (opt) { >>> + case 'i': >>> + printf("Interactive-mode selected\n"); >>> + interactive = 1; >>> + break; >>> + /* long options */ >>> + case 0: >>> + if (strncmp(long_option[idx].name, "iface", >>> + MAX_PATH_LEN) == 0) { >>> + strncpy(iface, optarg, MAX_PATH_LEN); >> >> Giving compiler warning [1], rte_strscpy() is safer to use. >> >> [1] >> In function ‘parse_args’, >> >> >> >> inlined from ‘main’ at .../examples/vdpa/main.c:419:8: >> >> >> >> .../examples/vdpa/main.c:76:5: error: ‘strncpy’ specified bound 128 equals >> destination size [-Werror=stringop-truncation] >> >> >> strncpy(iface, optarg, MAX_PATH_LEN); >> >> >> >> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Thanks for the finding, by the way, how do you get this warning? I can't see > it in my local build, what compiler you used? gcc, $ gcc --version gcc (GCC) 8.1.1 20180712 (Red Hat 8.1.1-5)