Re: [PATCH v2] selftests/damon: Add missing NULL checks after malloc()
From: SJ Park
Date: Tue Jul 21 2026 - 02:41:21 EST
Hello longlong,
>From the next time, when someone asked questions to your patch, please answer
the questions and keep the discussion until the next action item becomes clear.
Please don't post a new version without making sure such discussion is done.
Also, don't post a new version of a patch as a reply to the previous version.
Post as a new thread from the next time.
On Tue, 21 Jul 2026 14:05:42 +0800 longlong yan <yanlonglong@xxxxxxxxxx> wrote:
> In low-memory scenarios, malloc() can fail. Without checking,
> the test will dereference NULL and crash, causing the test harness
> to report a failure that is unrelated to DAMON functionality.
'test harness' means the DAMON selftests that internally runs the access_memory
and access_memory_even programs, suc as damos_apply_interval.py, right? Could
you share more details about how the test harness report a failure in the
situation?
> This is a false negative:
Shouldn't it be called false positive, as this is a context of tests?
> the test should skip or report a resource error,
> not crash and mask the actual test result.
>
> Add NULL checks after each malloc() call, printing an error message
> to stderr and returning -1 on failure.
The above description reads like this patch makes the DAMON selftets skip or
report a resource error. But I don't show how that works. Could you please
elaborate?
>
> Signed-off-by: longlong yan <yanlonglong@xxxxxxxxxx>
> ---
Please add changelog on the commentary area [1], with links to the previous
revisions.
[1] https://docs.kernel.org/process/submitting-patches.html#commentary
Thanks,
SJ
[...]