Skip to content

Commit 00e06cb

Browse files
Giorgi Tchankvetadzerppt
authored andcommitted
mm: mm_init: use div64_ul() instead of do_div()
Fixes Coccinelle/coccicheck warning reported by do_div.cocci. Compared to do_div(), div64_ul() does not implicitly cast the divisor and does not unnecessarily calculate the remainder. There are no functional changes. The benefit is purely a semantic cleanup that better communicates the intent of the division and resolves the static analysis warning. Signed-off-by: Giorgi Tchankvetadze <giorgitchankvetadze1997@gmail.com> Link: https://patch.msgid.link/20260602-mm-div64-cleanup-v1-1-bf5d67d89d93@gmail.com Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
1 parent 9588076 commit 00e06cb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

mm/mm_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2412,7 +2412,7 @@ void *__init alloc_large_system_hash(const char *tablename,
24122412
/* limit allocation size to 1/16 total memory by default */
24132413
if (max == 0) {
24142414
max = ((unsigned long long)nr_all_pages << PAGE_SHIFT) >> 4;
2415-
do_div(max, bucketsize);
2415+
max = div64_ul(max, bucketsize);
24162416
}
24172417
max = min(max, 0x80000000ULL);
24182418

0 commit comments

Comments
 (0)