net/ice: fix VSI array out of bounds access
authorJie Wang <jie1x.wang@intel.com>
Wed, 12 May 2021 03:14:07 +0000 (03:14 +0000)
committerQi Zhang <qi.z.zhang@intel.com>
Wed, 12 May 2021 12:21:09 +0000 (14:21 +0200)
In the loop, when the index of array "vsi->rss_key" is equal
to "vsi->rss_key_size", the array will be accessed out of bounds.

Fixes: 50370662b727 ("net/ice: support device and queue ops")
Cc: stable@dpdk.org
Signed-off-by: Jie Wang <jie1x.wang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/ice/ice_ethdev.c

index f742d07..5fd5f99 100644 (file)
@@ -3040,7 +3040,7 @@ static int ice_init_rss(struct ice_pf *pf)
        /* configure RSS key */
        if (!rss_conf->rss_key) {
                /* Calculate the default hash key */
-               for (i = 0; i <= vsi->rss_key_size; i++)
+               for (i = 0; i < vsi->rss_key_size; i++)
                        vsi->rss_key[i] = (uint8_t)rte_rand();
        } else {
                rte_memcpy(vsi->rss_key, rss_conf->rss_key,