The patch titled Subject: mm-fix-div-by-zero-in-bdi_ratio_from_pages-v2 has been added to the -mm mm-hotfixes-unstable branch. Its filename is mm-fix-div-by-zero-in-bdi_ratio_from_pages-v2.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-fix-div-by-zero-in-bdi_ratio_from_pages-v2.patch This patch will later appear in the mm-hotfixes-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Stefan Roesch <shr@xxxxxxxxxxxx> Subject: mm-fix-div-by-zero-in-bdi_ratio_from_pages-v2 Date: Tue, 7 Jan 2025 17:47:23 -0800 check for -EINVAL in bdi_set_min_bytes() and bdi_set_max_bytes() Link: https://lkml.kernel.org/r/20250108014723.166637-1-shr@xxxxxxxxxxxx Reported-by: cheung wall <zzqq0103.hey@xxxxxxxxx> Closes: https://lore.kernel.org/linux-mm/87pll35yd0.fsf@xxxxxxxxxxxx/T/#t Signed-off-by: Stefan Roesch <shr@xxxxxxxxxxxx> Cc: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/page-writeback.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/mm/page-writeback.c~mm-fix-div-by-zero-in-bdi_ratio_from_pages-v2 +++ a/mm/page-writeback.c @@ -799,6 +799,8 @@ int bdi_set_min_bytes(struct backing_dev return ret; min_ratio = bdi_ratio_from_pages(pages); + if (min_ratio == -EINVAL) + return -EINVAL; return __bdi_set_min_ratio(bdi, min_ratio); } @@ -818,6 +820,8 @@ int bdi_set_max_bytes(struct backing_dev return ret; max_ratio = bdi_ratio_from_pages(pages); + if (max_ratio == -EINVAL) + return -EINVAL; return __bdi_set_max_ratio(bdi, max_ratio); } _ Patches currently in -mm which might be from shr@xxxxxxxxxxxx are mm-fix-div-by-zero-in-bdi_ratio_from_pages.patch mm-fix-div-by-zero-in-bdi_ratio_from_pages-v2.patch