Commit 999b315d authored by Michal Kosiarz's avatar Michal Kosiarz Committed by Jeff Kirsher

i40e: Fix for division by zero

For some cases when reading from device are incorrect or image is
incorrect, this part of code causes crash due to division by zero.

Change-ID: I8961029a7a87b0a479995823ef8fcbf6471405e1
Signed-off-by: default avatarMichal Kosiarz <michal.kosiarz@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 13fd3f9c
...@@ -3313,8 +3313,10 @@ static void i40e_parse_discover_capabilities(struct i40e_hw *hw, void *buff, ...@@ -3313,8 +3313,10 @@ static void i40e_parse_discover_capabilities(struct i40e_hw *hw, void *buff,
/* partition id is 1-based, and functions are evenly spread /* partition id is 1-based, and functions are evenly spread
* across the ports as partitions * across the ports as partitions
*/ */
hw->partition_id = (hw->pf_id / hw->num_ports) + 1; if (hw->num_ports != 0) {
hw->num_partitions = num_functions / hw->num_ports; hw->partition_id = (hw->pf_id / hw->num_ports) + 1;
hw->num_partitions = num_functions / hw->num_ports;
}
/* additional HW specific goodies that might /* additional HW specific goodies that might
* someday be HW version specific * someday be HW version specific
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment