[PATCH v2 0/3] mm: improve insert_pages() error handling
From: Avi Weiss
Date: Wed Aug 05 2026 - 10:51:00 EST
Improve insert_pages() error handling following review of the minor
cleanup in v1.
Rename the helper that populates the upper page-table levels, set error
codes at their points of failure, and return -ENOMEM when that
population fails.
Thanks for the review. I'm new to Linux; most of my previous upstream
work has been on NASA cFS and RTEMS.
I agree that initializing the return value to zero and assigning each
relevant error code at its failure site is clearer and more idiomatic.
The second (middle) patch implements that cleanup.
The pte_alloc() macro returns a boolean, so patch 2 tests it and assigns
-ENOMEM explicitly rather than using its return value as an error code.
Changes in v2:
* rename walk_to_pmd() to populate_to_pmd()
* set error codes at their points of failure and rename ret to err
* split the cleanup and return-code change into separate patches
* drop the Fixes tag because this is a general cleanup
Avi Weiss (3):
mm/memory.c: rename walk_to_pmd() to populate_to_pmd()
mm/memory.c: simplify error handling in insert_pages()
mm: return -ENOMEM for page-table allocation failure in insert_pages()
mm/memory.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
base-commit: 848acc8ffe1b7cd5f1bf427b93069becfebc2c9d
--
2.43.0