[EXTERNAL] [PATCH 23/62] net/netvsc: use kvargs numeric helpers

Wei Hu weh at microsoft.com
Mon Sep 14 14:43:56 CEST 2026



> -----Original Message-----
> From: Stephen Hemminger <stephen at networkplumber.org>
> Sent: Monday, September 14, 2026 1:47 PM
> To: dev at dpdk.org
> Cc: Stephen Hemminger <stephen at networkplumber.org>; Long Li
> <longli at microsoft.com>; Wei Hu <weh at microsoft.com>
> Subject: [EXTERNAL] [PATCH 23/62] net/netvsc: use kvargs numeric helpers
> 
> hn_set_parameter() does not check errno, so an out of range value is accepted
> as ULONG_MAX, and the result is stored into 32-bit fields without any range
> check.
> 
> This also drops support for octal, which base 0 accepted; hexadecimal still
> works.
> 
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>

Reviewed-by: Wei Hu <weh at microsoft.com>


> ---
>  drivers/net/netvsc/hn_ethdev.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
> index 9a193e4a7a..d9f60ec279 100644
> --- a/drivers/net/netvsc/hn_ethdev.c
> +++ b/drivers/net/netvsc/hn_ethdev.c
> @@ -202,11 +202,9 @@ eth_dev_vmbus_release(struct rte_eth_dev
> *eth_dev)  static int hn_set_parameter(const char *key, const char *value,
> void *opaque)  {
>  	struct hn_data *hv = opaque;
> -	char *endp = NULL;
> -	unsigned long v;
> +	uint64_t v;
> 
> -	v = strtoul(value, &endp, 0);
> -	if (*value == '\0' || *endp != '\0') {
> +	if (rte_kvargs_to_uint(value, 0, UINT32_MAX, &v) < 0) {
>  		PMD_DRV_LOG(ERR, "invalid parameter %s=%s", key, value);
>  		return -EINVAL;
>  	}
> --
> 2.53.0



More information about the dev mailing list