From: Gu Zitao guzitao@wxiat.com
Sunway inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4SPZD CVE: NA
-------------------------------
The node id of hose is used to denote topological physical id of PCI host bridge, however one may start up the machine by command line 'numa=off' to switch off NUMA system, and this case may raise exception on the node id passed to alloc_pages_node, so let's use dev_to_node(dev) instead and ensure the correctness of the parameter passed in.
Signed-off-by: Gu Zitao guzitao@wxiat.com #openEuler_contributor Signed-off-by: Laibin Qiu qiulaibin@huawei.com Reviewed-by: Hanjun Guo guohanjun@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- drivers/iommu/sw64/sunway_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iommu/sw64/sunway_iommu.c b/drivers/iommu/sw64/sunway_iommu.c index 4eb29209e4bc..dd3382ee007f 100644 --- a/drivers/iommu/sw64/sunway_iommu.c +++ b/drivers/iommu/sw64/sunway_iommu.c @@ -1044,7 +1044,7 @@ static void *sunway_alloc_coherent(struct device *dev, gfp &= ~GFP_DMA;
try_again: - page = alloc_pages_node(hose->node, gfp | __GFP_ZERO, get_order(size)); + page = alloc_pages_node(dev_to_node(dev), gfp | __GFP_ZERO, get_order(size)); cpu_addr = page_address(page); if (!cpu_addr) { pr_info