OSDN Git Service

hugetlb: use sizeof() to get the array size
authorMiaohe Lin <linmiaohe@huawei.com>
Thu, 1 Sep 2022 12:00:24 +0000 (20:00 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 12 Sep 2022 03:26:09 +0000 (20:26 -0700)
It's better to use sizeof() to get the array size instead of manual
calculation. Minor readability improvement.

Link: https://lkml.kernel.org/r/20220901120030.63318-5-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/hugetlb.c

index fddbda2..4d2efdf 100644 (file)
@@ -4149,11 +4149,11 @@ static void __init hugepages_clear_pages_in_node(void)
        if (!hugetlb_max_hstate) {
                default_hstate_max_huge_pages = 0;
                memset(default_hugepages_in_node, 0,
-                       MAX_NUMNODES * sizeof(unsigned int));
+                       sizeof(default_hugepages_in_node));
        } else {
                parsed_hstate->max_huge_pages = 0;
                memset(parsed_hstate->max_huge_pages_node, 0,
-                       MAX_NUMNODES * sizeof(unsigned int));
+                       sizeof(parsed_hstate->max_huge_pages_node));
        }
 }