]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm: refactor mm_access() to not return NULL
authorLorenzo Stoakes <lorenzo.stoakes@oracle.com>
Tue, 24 Sep 2024 20:10:23 +0000 (21:10 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 1 Nov 2024 04:28:44 +0000 (21:28 -0700)
commitab74472083611c824fb046f43a06c1abd849456d
tree484563ab1e5aa3a70d4f9632d9b50fc61d7d1857
parentc2736540c753e85f0088f1010e4a9a2ca2028274
mm: refactor mm_access() to not return NULL

mm_access() can return NULL if the mm is not found, but this is handled
the same as an error in all callers, with some translating this into an
-ESRCH error.

Only proc_mem_open() returns NULL if no mm is found, however in this case
it is clearer and makes more sense to explicitly handle the error.
Additionally we take the opportunity to refactor the function to eliminate
unnecessary nesting.

Simplify things by simply returning -ESRCH if no mm is found - this both
eliminates confusing use of the IS_ERR_OR_NULL() macro, and simplifies
callers which would return -ESRCH by returning this error directly.

Link: https://lkml.kernel.org/r/20240924201023.193135-1-lorenzo.stoakes@oracle.com
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/proc/base.c
kernel/fork.c
mm/madvise.c
mm/process_vm_access.c