X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Ffailsafe%2Ffailsafe_args.c;h=b203e02d9ac1a9b62ad05ad40ba7ad460a6831b5;hb=95de0faf12d4a226d77ce9fbc52df83e63904c3b;hp=c4b220c48112a2a2b1469ec7af0d074fa6846f02;hpb=520dd9923b351ea7a3b7476d3a04542ab0d9ad0c;p=dpdk.git diff --git a/drivers/net/failsafe/failsafe_args.c b/drivers/net/failsafe/failsafe_args.c index c4b220c481..b203e02d9a 100644 --- a/drivers/net/failsafe/failsafe_args.c +++ b/drivers/net/failsafe/failsafe_args.c @@ -102,7 +102,7 @@ fs_execute_cmd(struct sub_device *sdev, char *cmdline) ERROR("Command line allocation failed"); return -ENOMEM; } - snprintf(sdev->cmdline, len, "%s", cmdline); + strlcpy(sdev->cmdline, cmdline, len); /* Replace all commas in the command line by spaces */ for (i = 0; i < len; i++) if (sdev->cmdline[i] == ',') @@ -367,16 +367,12 @@ static int fs_get_mac_addr_arg(const char *key __rte_unused, const char *value, void *out) { - struct ether_addr *ea = out; - int ret; + struct rte_ether_addr *ea = out; if ((value == NULL) || (out == NULL)) return -EINVAL; - ret = sscanf(value, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", - &ea->addr_bytes[0], &ea->addr_bytes[1], - &ea->addr_bytes[2], &ea->addr_bytes[3], - &ea->addr_bytes[4], &ea->addr_bytes[5]); - return ret != ETHER_ADDR_LEN; + + return rte_ether_unformat_addr(value, ea); } int @@ -455,8 +451,7 @@ failsafe_args_free(struct rte_eth_dev *dev) sdev->cmdline = NULL; free(sdev->fd_str); sdev->fd_str = NULL; - free(sdev->devargs.args); - sdev->devargs.args = NULL; + rte_devargs_reset(&sdev->devargs); } }