[dpdk-stable] [PATCH] net/i40e: add parameter check for RSS flow init
Ferruh Yigit
ferruh.yigit at intel.com
Wed Nov 14 00:11:02 CET 2018
On 11/12/2018 9:25 AM, Wei Zhao wrote:
> There need an parameter check for RSS flow init, or it may cause
> core dump if pointer is NULL in memory copy.
>
> Fixes: ac8d22de2394 ("ethdev: flatten RSS configuration in flow API")
>
> Signed-off-by: Wei Zhao <wei.zhao1 at intel.com>
> ---
> drivers/net/i40e/i40e_ethdev.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 1c77906..217a8dc 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -12552,13 +12552,16 @@ i40e_rss_conf_init(struct i40e_rte_flow_rss_conf *out,
> if (in->key_len > RTE_DIM(out->key) ||
> in->queue_num > RTE_DIM(out->queue))
> return -EINVAL;
> + if (!in->key && in->key_len)
> + return -EINVAL;
> + if (out->key && in->key)
> + out->conf.key = memcpy(out->key, in->key, in->key_len);
Giving following warning [1] with clang, which looks like valid warning.
i40e_rte_flow_rss_conf->key is an array, no need to check its address.
I will remove it while merging.
[1]
.../drivers/net/i40e/i40e_ethdev.c:12557:11: error: address of array 'out->key'
will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
if (out->key && in->key)
~~~~~^~~ ~~
> out->conf = (struct rte_flow_action_rss){
> .func = in->func,
> .level = in->level,
> .types = in->types,
> .key_len = in->key_len,
> .queue_num = in->queue_num,
> - .key = memcpy(out->key, in->key, in->key_len),
> .queue = memcpy(out->queue, in->queue,
> sizeof(*in->queue) * in->queue_num),
> };
>
More information about the stable
mailing list