mirror of https://gitee.com/openkylin/linux.git
ice: Check root pointer for validity
ice_sched_get_tc_node uses pi->root without checking for NULL. Add a check to prevent NULL pointer dereference. Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
parent
208ff75135
commit
ade78c2ec1
|
@ -284,7 +284,7 @@ struct ice_sched_node *ice_sched_get_tc_node(struct ice_port_info *pi, u8 tc)
|
|||
{
|
||||
u8 i;
|
||||
|
||||
if (!pi)
|
||||
if (!pi || !pi->root)
|
||||
return NULL;
|
||||
for (i = 0; i < pi->root->num_children; i++)
|
||||
if (pi->root->children[i]->tc_num == tc)
|
||||
|
|
Loading…
Reference in New Issue