[PATCH] mm: cma: fix ZERO_SIZE_PTR check

From: Minchan Kim
Date: Mon Mar 08 2021 - 14:33:47 EST


If there is no cma instance, cma_area_count will be zero and
kmalloc_arrary will return ZERO_SITE_PTR instead of NULL.

Use ZERO_OR_NULL_PTR to check both cases.

Link: https://lore.kernel.org/linux-mm/20210308152620.GE4324@xsang-OptiPlex-9020/
Reported-by: kernel test robot <oliver.sang@xxxxxxxxx>
Signed-off-by: Minchan Kim <minchan@xxxxxxxxxx>
---
mm/cma_sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/cma_sysfs.c b/mm/cma_sysfs.c
index 67b63167eaf5..fdcb952ff13f 100644
--- a/mm/cma_sysfs.c
+++ b/mm/cma_sysfs.c
@@ -81,7 +81,7 @@ static int __init cma_sysfs_init(void)

cma_stats = kmalloc_array(cma_area_count, sizeof(struct cma_stat),
GFP_KERNEL|__GFP_ZERO);
- if (!cma_stats)
+ if (ZERO_OR_NULL_PTR(cma_stats))
goto out;

do {
--
2.30.1.766.gb4fecdf3b7-goog