net/bonding: check error of MAC address setting
authorRadu Nicolau <radu.nicolau@intel.com>
Thu, 1 Feb 2018 17:21:26 +0000 (17:21 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 5 Feb 2018 15:51:51 +0000 (16:51 +0100)
Coverity issue: 260405
Fixes: 2efb58cbab6e ("bond: new link bonding library")
Cc: stable@dpdk.org
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
drivers/net/bonding/rte_eth_bond_api.c

index 149e9e1..f854b73 100644 (file)
@@ -259,8 +259,13 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id)
        if (internals->slave_count < 1) {
                /* if MAC is not user defined then use MAC of first slave add to
                 * bonded device */
-               if (!internals->user_defined_mac)
-                       mac_address_set(bonded_eth_dev, slave_eth_dev->data->mac_addrs);
+               if (!internals->user_defined_mac) {
+                       if (mac_address_set(bonded_eth_dev,
+                                           slave_eth_dev->data->mac_addrs)) {
+                               RTE_BOND_LOG(ERR, "Failed to set MAC address");
+                               return -1;
+                       }
+               }
 
                /* Inherit eth dev link properties from first slave */
                link_properties_set(bonded_eth_dev,