Skip to content

Commit b8af344

Browse files
Hao Chenkuba-moo
authored andcommitted
net: hns3: add check NULL address for page pool
When page pool is not enabled, its address value is still NULL and page pool should not be accessed, so add a check for it. Fixes: 850bfb9 ("net: hns3: debugfs add support dumping page pool info") Signed-off-by: Hao Chen <[email protected]> Signed-off-by: Guangbin Huang <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 8d2ad99 commit b8af344

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,11 @@ hns3_dbg_page_pool_info(struct hnae3_handle *h, char *buf, int len)
11061106
return -EFAULT;
11071107
}
11081108

1109+
if (!priv->ring[h->kinfo.num_tqps].page_pool) {
1110+
dev_err(&h->pdev->dev, "page pool is not initialized\n");
1111+
return -EFAULT;
1112+
}
1113+
11091114
for (i = 0; i < ARRAY_SIZE(page_pool_info_items); i++)
11101115
result[i] = &data_str[i][0];
11111116

0 commit comments

Comments
 (0)