net/ice/base: 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> Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com> Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
This commit is contained in:
parent
348ea028ea
commit
a823afa55f
@ -284,7 +284,7 @@ struct ice_sched_node *ice_sched_get_tc_node(struct ice_port_info *pi, u8 tc)
|
|||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
|
|
||||||
if (!pi)
|
if (!pi || !pi->root)
|
||||||
return NULL;
|
return NULL;
|
||||||
for (i = 0; i < pi->root->num_children; i++)
|
for (i = 0; i < pi->root->num_children; i++)
|
||||||
if (pi->root->children[i]->tc_num == tc)
|
if (pi->root->children[i]->tc_num == tc)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user