From: sashiko-bot@kernel.org
To: "Maxim Levitsky" <mlevitsk@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: selftests: access_tracking_perf_test: bump number of NUMA nodes to 32
Date: Fri, 12 Jun 2026 15:08:42 +0000 [thread overview]
Message-ID: <20260612150842.DF9ED1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260612150038.1277394-1-mlevitsk@redhat.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [Medium] Incorrect type for `asprintf` return value defeats error checking and causes undefined behavior/crash if allocation fails.
--
commit c131ebf5598f598f5bdd7d212b93b7da852ad82f
Author: Maxim Levitsky <mlevitsk@redhat.com>
KVM: selftests: access_tracking_perf_test: bump number of NUMA nodes to 32
It's rare to find a system that has more than 4 sockets, but a system can
have more than 4 NUMA nodes if each socket exposes its chiplets as separate
NUMA nodes. Bump the limit to 32, just in case.
> diff --git a/tools/testing/selftests/kvm/include/lru_gen_util.h b/tools/testing/selftests/kvm/include/lru_gen_util.h
> index d32ff5d8ffd05..49c8139d398ca 100644
> --- a/tools/testing/selftests/kvm/include/lru_gen_util.h
> +++ b/tools/testing/selftests/kvm/include/lru_gen_util.h
> @@ -14,7 +14,7 @@
> #include "test_util.h"
>
> #define MAX_NR_GENS 16 /* MAX_NR_GENS in include/linux/mmzone.h */
> -#define MAX_NR_NODES 4 /* Maximum number of nodes supported by the test */
> +#define MAX_NR_NODES 32 /* Maximum number of nodes supported by the test */
[Severity: Medium]
This is a pre-existing issue, but does run_aging_impl() in
tools/testing/selftests/kvm/lib/lru_gen_util.c mishandle the return value of
asprintf() when creating the aging command?
tools/testing/selftests/kvm/lib/lru_gen_util.c:run_aging_impl() {
...
FILE *f = fopen(LRU_GEN_DEBUGFS, "w");
char *command;
size_t sz;
TEST_ASSERT(f, "fopen(%s) failed", LRU_GEN_DEBUGFS);
sz = asprintf(&command, "+ %lu %d %d 1 %d\n",
memcg_id, node_id, max_gen, force_scan);
TEST_ASSERT(sz > 0, "creating aging command failed");
...
}
asprintf() returns an int which is -1 on failure. Because it is assigned
to the size_t sz variable, -1 wraps around to SIZE_MAX. The error check
TEST_ASSERT(sz > 0, ...) will incorrectly pass, and the code will then call
fwrite() with an undefined command pointer and SIZE_MAX size, resulting in a
segmentation fault rather than a graceful test failure.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260612150038.1277394-1-mlevitsk@redhat.com?part=1
prev parent reply other threads:[~2026-06-12 15:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-12 15:00 [PATCH] KVM: selftests: access_tracking_perf_test: bump number of NUMA nodes to 32 Maxim Levitsky
2026-06-12 15:08 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260612150842.DF9ED1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=mlevitsk@redhat.com \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox