Skip to content

Commit

Permalink
net/ice: fix build with GCC 12
Browse files Browse the repository at this point in the history
[ upstream commit 20d6a017e148cc1944d85d4c80a0151a5b4c6436 ]

GCC 12 raises the following warning:

In file included from ../lib/mempool/rte_mempool.h:46,
                 from ../lib/mbuf/rte_mbuf.h:38,
                 from ../lib/net/rte_ether.h:22,
                 from ../lib/ethdev/rte_ethdev.h:172,
                 from ../lib/ethdev/ethdev_driver.h:22,
                 from ../lib/ethdev/ethdev_pci.h:17,
                 from ../drivers/net/ice/ice_ethdev.c:6:
../drivers/net/ice/ice_ethdev.c: In function ‘ice_dev_configure’:
../lib/eal/x86/include/rte_memcpy.h:370:9: warning: array subscript 64 is
        outside array bounds of ‘struct ice_aqc_get_set_rss_keys[1]’
        [-Warray-bounds]
  370 | rte_mov32((uint8_t *)dst + 2 * 32, (const uint8_t *)src + 2 * 32);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../drivers/net/ice/ice_ethdev.c:3202:41: note: while referencing ‘key’
 3202 |         struct ice_aqc_get_set_rss_keys key;
      |                                         ^~~

Restrict copy to minimum size.

Bugzilla ID: 850

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
  • Loading branch information
david-marchand authored and cpaelzer committed Jul 7, 2022
1 parent 1093a40 commit b4c2dfe
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/ice/ice_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2544,7 +2544,8 @@ static int ice_init_rss(struct ice_pf *pf)
RTE_MIN(rss_conf->rss_key_len,
vsi->rss_key_size));

rte_memcpy(key.standard_rss_key, vsi->rss_key, vsi->rss_key_size);
rte_memcpy(key.standard_rss_key, vsi->rss_key,
RTE_MIN(sizeof(key.standard_rss_key), vsi->rss_key_size));
ret = ice_aq_set_rss_key(hw, vsi->idx, &key);
if (ret)
goto out;
Expand Down

0 comments on commit b4c2dfe

Please sign in to comment.