[dpdk-dev] [PATCH v3] net/ring: fix unchecked return value

Ferruh Yigit ferruh.yigit at intel.com
Tue Oct 13 19:23:53 CEST 2020


On 10/13/2020 2:07 PM, Kevin Laatz wrote:
> Add a check for the return value of the sscanf call in
> parse_internal_args(), returning an error if we don't get the expected
> result.
> 
> Coverity issue: 362049
> Fixes: 96cb19521147 ("net/ring: use EAL APIs in PMD specific API")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Kevin Laatz <kevin.laatz at intel.com>

<...>

> +#define ETH_RING_INTERNAL_ARG_MAX_LEN	19

Added following comment while merging: /* "0x..16chars..\0" */

<...>

> -	sscanf(value, "%p", &args);
> +	/* make sure 'value' is valid pointer length */
> +	if (strnlen(value, ETH_RING_INTERNAL_ARG_MAX_LEN) >=
> +			ETH_RING_INTERNAL_ARG_MAX_LEN) {
> +		PMD_LOG(ERR, "Error parsing internal args, 'value' too long");

'value' is variable name and may not fit to the debug log.
Replaced with "..., argument is too long" while merging.

Reviewed-by: Ferruh Yigit <ferruh.yigit at intel.com>
Applied to dpdk-next-net/main, thanks.


More information about the dev mailing list