Hello longlong,
I found get_maitnainer.pl is suggesting to Cc below recipients. - Lorenzo Stoakes <[email protected]> - "Liam R. Howlett" <[email protected]> - Vlastimil Babka <[email protected]> - Mike Rapoport <[email protected]> - Suren Baghdasaryan <[email protected]> - Michal Hocko <[email protected]> On Tue, 21 Jul 2026 14:36:11 +0800 longlong yan <[email protected]> wrote: > The pagemap_ioctl selftest allocates memory via calloc() in several > places but does not check the return values. If calloc() fails, the > subsequent code will dereference a NULL pointer and crash. > > Additionally, in sanity_tests(), the calloc() failure check incorrectly > uses MAP_FAILED (the mmap() error constant) instead of NULL. Since > calloc() returns NULL on failure, the check never triggers and a > failed allocation goes undetected. > > Add NULL checks after each calloc() call, and fix the wrong error > constant in sanity_tests(). Use ksft_exit_fail_msg() consistent with > the existing error handling pattern in the file. Makes sense to me. > > Signed-off-by: longlong yan <[email protected]> I have a trivial comment below. Regardless of that, Reviewed-by: SJ Park <[email protected]> > --- > tools/testing/selftests/mm/pagemap_ioctl.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) [...] > @@ -1000,6 +1004,8 @@ int unmapped_region_tests(void) > int written, len = 0x00040000; > long vec_size = len / page_size; > struct page_region *vec = calloc(vec_size, sizeof(struct page_region)); > + if (!vec) > + ksft_exit_fail_msg("error nomem\n"); I'd suggest to separate the definitions and statements by putting an empty line in the middle. Thanks, SJ [...]

