net/iavf: fix RSS key access out of bound
authorHaiyue Wang <haiyue.wang@intel.com>
Wed, 19 May 2021 07:59:33 +0000 (15:59 +0800)
committerQi Zhang <qi.z.zhang@intel.com>
Thu, 10 Jun 2021 10:04:16 +0000 (12:04 +0200)
The array rss_key has size 'vf->vf_res->rss_key_size', the array index
should be less than that.

Cc: stable@dpdk.org
Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
drivers/net/iavf/iavf_ethdev.c

index a7ef7a6..5290588 100644 (file)
@@ -366,7 +366,7 @@ iavf_init_rss(struct iavf_adapter *adapter)
        /* configure RSS key */
        if (!rss_conf->rss_key) {
                /* Calculate the default hash key */
-               for (i = 0; i <= vf->vf_res->rss_key_size; i++)
+               for (i = 0; i < vf->vf_res->rss_key_size; i++)
                        vf->rss_key[i] = (uint8_t)rte_rand();
        } else
                rte_memcpy(vf->rss_key, rss_conf->rss_key,