Project

General

Profile

Bug #13046

Updated by Marcel Telka 4 months ago

In the function i40e_parse_discover_capabilities(), the i40e_hw elements of num_ports and num_partitions are initialized to zero; such that if the driver fails to discover any active ports, both values will be zero after the function returns.    Yet in i40e_device_find, it is ASSRT'd that both values are non-zero; and further tries to use values later that are expected to be non-zero. 

 Instead, the function should check if either value is non-zero and return a NULL i40e_device_t (callers check to see if the return is NULL, and will fail the configuration). 

 Suggested code: 

 <pre> 
                 

                 /* 
                  * Though remote, it is possible that both ports and partitions 
                  * can be zero.    Though it is possible that this is a temporary 
                  * condition, this driver doesn't have a way of being restarted, 
                  * so we fail here and maybe a future attach will be better. 
                  */ 
                 if (hw->num_ports == 0 || hw->num_partitions == 0) { 
                         i40e_error(i40e, "Device doesn't have ports or partitions"); 
                         return (NULL); 
                 } 
 </pre>

Back