diff options
author | Vratko Polak <vrpolak@cisco.com> | 2024-09-03 16:37:49 +0200 |
---|---|---|
committer | Vratko Polak <vrpolak@cisco.com> | 2024-09-03 16:37:49 +0200 |
commit | 2f76b57280e76220ed7cad244059aa4f624371f4 (patch) | |
tree | c06bcad5f4149c1d695f4f2ad692341943014ea4 /src/plugins/dev_iavf/port.c | |
parent | f0e81d247b7cd13b621262f29ed1ae6366b68b78 (diff) |
iavf: fully support off-by-one driver behavior
Previously, iavf_port_add_del_eth_addr was not using large enough buffer
and address sanitizer does not allow that.
Type: fix
Change-Id: Icd1491fb5651aed20685d15224e9c725347ef369
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'src/plugins/dev_iavf/port.c')
-rw-r--r-- | src/plugins/dev_iavf/port.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/plugins/dev_iavf/port.c b/src/plugins/dev_iavf/port.c index 7e4200ab37c..f1578fccb59 100644 --- a/src/plugins/dev_iavf/port.c +++ b/src/plugins/dev_iavf/port.c @@ -91,7 +91,7 @@ iavf_port_init_rss (vlib_main_t *vm, vnet_dev_port_t *port) .key_len = keylen, }; - clib_memcpy (key->key, default_rss_key, sizeof (default_rss_key)); + clib_memcpy (key->key, default_rss_key, keylen); return iavf_vc_op_config_rss_key (vm, dev, key); } @@ -425,17 +425,20 @@ iavf_port_add_del_eth_addr (vlib_main_t *vm, vnet_dev_port_t *port, int is_primary) { iavf_port_t *ap = vnet_dev_get_port_data (port); - virtchnl_ether_addr_list_t al = { + u8 buffer[VIRTCHNL_MSG_SZ (virtchnl_ether_addr_list_t, list, 1)]; + virtchnl_ether_addr_list_t *al = (virtchnl_ether_addr_list_t *) buffer; + + *al = (virtchnl_ether_addr_list_t){ .vsi_id = ap->vsi_id, .num_elements = 1, .list[0].primary = is_primary ? 1 : 0, .list[0].extra = is_primary ? 0 : 1, }; - clib_memcpy (al.list[0].addr, addr, sizeof (al.list[0].addr)); + clib_memcpy (al->list[0].addr, addr, sizeof (al->list[0].addr)); - return is_add ? iavf_vc_op_add_eth_addr (vm, port->dev, &al) : - iavf_vc_op_del_eth_addr (vm, port->dev, &al); + return is_add ? iavf_vc_op_add_eth_addr (vm, port->dev, al) : + iavf_vc_op_del_eth_addr (vm, port->dev, al); } static vnet_dev_rv_t |