X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fvhost%2Fioat.c;h=71d8a1f1f597412e0a45efb816f91dc453d41ea7;hb=ecf1474a618ba77ef3c4471fdc004a8c5f3b4d11;hp=b2c74f65379f22668d576bae407fbb67882c7b3f;hpb=abec60e7115dc3197ffc94a1eee9353b9b808600;p=dpdk.git diff --git a/examples/vhost/ioat.c b/examples/vhost/ioat.c index b2c74f6537..71d8a1f1f5 100644 --- a/examples/vhost/ioat.c +++ b/examples/vhost/ioat.c @@ -1,9 +1,11 @@ /* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2010-2020 Intel Corporation */ + +#include +#ifdef RTE_RAW_IOAT #include #include -#include #include "ioat.h" #include "main.h" @@ -36,7 +38,7 @@ open_ioat(const char *value) int ret = 0; uint16_t i = 0; char *dma_arg[MAX_VHOST_DEVICE]; - uint8_t args_nr; + int args_nr; while (isblank(*addrs)) addrs++; @@ -54,9 +56,18 @@ open_ioat(const char *value) } args_nr = rte_strsplit(substr, strlen(substr), dma_arg, MAX_VHOST_DEVICE, ','); - do { + if (args_nr <= 0) { + ret = -1; + goto out; + } + while (i < args_nr) { char *arg_temp = dma_arg[i]; - rte_strsplit(arg_temp, strlen(arg_temp), ptrs, 2, '@'); + uint8_t sub_nr; + sub_nr = rte_strsplit(arg_temp, strlen(arg_temp), ptrs, 2, '@'); + if (sub_nr != 2) { + ret = -1; + goto out; + } start = strstr(ptrs[0], "txd"); if (start == NULL) { @@ -105,7 +116,7 @@ open_ioat(const char *value) dma_info->nr++; i++; - } while (i < args_nr); + } out: free(input); return ret; @@ -199,3 +210,5 @@ ioat_check_completed_copies_cb(int vid, uint16_t queue_id, /* Opaque data is not supported */ return -1; } + +#endif /* RTE_RAW_IOAT */