Add checking return value of string split function to fix the
coverity issue.

Fixes: 3a04ecb21420 ("examples/vhost: add async vhost args parsing")
Coverity issue: 363739

Signed-off-by: Cheng Jiang <cheng1.ji...@intel.com>
---
 examples/vhost/ioat.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/examples/vhost/ioat.c b/examples/vhost/ioat.c
index b2c74f6537..04806c02d7 100644
--- a/examples/vhost/ioat.c
+++ b/examples/vhost/ioat.c
@@ -54,9 +54,14 @@ open_ioat(const char *value)
        }
        args_nr = rte_strsplit(substr, strlen(substr),
                        dma_arg, MAX_VHOST_DEVICE, ',');
-       do {
+       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 +110,7 @@ open_ioat(const char *value)
 
                dma_info->nr++;
                i++;
-       } while (i < args_nr);
+       }
 out:
        free(input);
        return ret;
-- 
2.29.2

Reply via email to