]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf kvm: Fix debug assertion
authorIan Rogers <irogers@google.com>
Sat, 22 Nov 2025 08:19:13 +0000 (00:19 -0800)
committerNamhyung Kim <namhyung@kernel.org>
Wed, 3 Dec 2025 19:07:19 +0000 (11:07 -0800)
There are 2 slots left for kvm_add_default_arch_event, fix the
assertion so that debug builds don't fail the assert and to agree with
the comment.

Fixes: 45ff39f6e70aa55d0 ("perf tools kvm: Fix the potential out of range memory access issue")
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/builtin-kvm.c

index f0f285763f190aa28e225080fd90710ceea5c2ae..c61369d54dd9d0206eb079da78fdd2d902925fc6 100644 (file)
@@ -2014,7 +2014,7 @@ static int __cmd_record(const char *file_name, int argc, const char **argv)
        for (j = 1; j < argc; j++, i++)
                rec_argv[i] = STRDUP_FAIL_EXIT(argv[j]);
 
-       BUG_ON(i != rec_argc);
+       BUG_ON(i + 2 != rec_argc);
 
        ret = kvm_add_default_arch_event(&i, rec_argv);
        if (ret)