[dpdk-dev] [PATCH v8 2/2] examples/vdpa: introduce a new sample for vDPA

Ferruh Yigit ferruh.yigit at intel.com
Wed Oct 3 09:48:12 CEST 2018


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 <xiaolong.ye at intel.com>
>>> Acked-by: Xiao Wang <xiao.w.wang at intel.com>
>>> Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>
>>
>> <...>
>>
>>> +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)


More information about the dev mailing list