int ret = 0;
uint16_t i = 0;
char *dma_arg[MAX_VHOST_DEVICE];
- uint8_t args_nr;
+ int args_nr;
while (isblank(*addrs))
addrs++;
}
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) {
dma_info->nr++;
i++;
- } while (i < args_nr);
+ }
out:
free(input);
return ret;