From: sashiko-bot@kernel.org
To: "Arnaldo Carvalho de Melo" <acme@kernel.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 1/2] perf c2c: Fix error masking, OOM, and unchecked caller errors in hpp_list__parse()
Date: Tue, 04 Aug 2026 19:12:21 +0000 [thread overview]
Message-ID: <20260804191221.84C921F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260804185830.228763-2-acme@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Silent error masking and inconsistent propagation for -ENOMEM during sort and output token parsing in setup_sort_list() and setup_output_list().
--
--- Patch [1]: [PATCH 1/2] perf c2c: Fix error masking, OOM, and unchecked caller errors in hpp_list__parse() ---
commit c1a9e4a1694a477755b6abff539aa40b1fed31e1
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
perf c2c: Fix error masking, OOM, and unchecked caller errors in hpp_list__parse()
This commit fixes three bugs in hpp_list__parse() by checking strdup()
return values and adding a cleanup label to preserve early errors. It also
converts PARSE_LIST to a function, changing called functions to return
appropriate error codes like -ENOMEM instead of -1 on failure.
> diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
> index 005e7d85dc4a5..616a583e3d4d6 100644
> --- a/tools/perf/util/sort.c
> +++ b/tools/perf/util/sort.c
[ ... ]
> @@ -3869,8 +3877,7 @@ int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
> strlen(tok)))
> return -EINVAL;
>
> - __sort_dimension__add(sd, list, level);
> - return 0;
> + return __sort_dimension__add(sd, list, level);
> }
>
> for (i = 0; i < ARRAY_SIZE(memory_sort_dimensions); i++) {
[Severity: Medium]
Since sort_dimension__add() can now return -ENOMEM, could this introduce a
regression where the callers in setup_sort_list() and setup_output_list()
fail to handle the new return value?
Currently, setup_sort_list() only checks for -EINVAL and -ESRCH:
tools/perf/util/sort.c:setup_sort_list() {
...
ret = sort_dimension__add(list, tok, evlist, env, level);
if (ret == -EINVAL) {
...
break;
} else if (ret == -ESRCH) {
...
break;
}
...
}
If sort_dimension__add() returns -ENOMEM, the loop will not break and ret
will be silently overwritten on the next iteration.
A similar issue appears to exist in setup_output_list() which ignores
-ENOMEM from output_field_add().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260804185830.228763-1-acme@kernel.org?part=1
next prev parent reply other threads:[~2026-08-04 19:12 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 18:58 [PATCHES v7 0/2] perf c2c hardening Arnaldo Carvalho de Melo
2026-08-04 18:58 ` [PATCH 1/2] perf c2c: Fix error masking, OOM, and unchecked caller errors in hpp_list__parse() Arnaldo Carvalho de Melo
2026-08-04 19:12 ` sashiko-bot [this message]
2026-08-04 18:58 ` [PATCH 2/2] perf c2c: Clean up registered formats on c2c_hists__init() and c2c_hists__reinit() failure Arnaldo Carvalho de Melo
2026-08-04 19:15 ` sashiko-bot
-- strict thread matches above, loose matches on Subject: below --
2026-08-05 15:10 [PATCHES v8 0/2] perf c2c hardening Arnaldo Carvalho de Melo
2026-08-05 15:10 ` [PATCH 1/2] perf c2c: Fix error masking, OOM, and unchecked caller errors in hpp_list__parse() Arnaldo Carvalho de Melo
2026-08-06 0:00 ` Ian Rogers
2026-08-03 18:07 [PATCHES v6 0/2] perf c2c hardening Arnaldo Carvalho de Melo
2026-08-03 18:07 ` [PATCH 1/2] perf c2c: Fix error masking, OOM, and unchecked caller errors in hpp_list__parse() Arnaldo Carvalho de Melo
2026-08-03 18:26 ` sashiko-bot
2026-08-03 18:01 [PATCHES v5 0/2] perf c2c hardening Arnaldo Carvalho de Melo
2026-08-03 18:01 ` [PATCH 1/2] perf c2c: Fix error masking, OOM, and unchecked caller errors in hpp_list__parse() Arnaldo Carvalho de Melo
2026-08-03 14:41 [PATCHES v4 0/2] perf c2c hardening Arnaldo Carvalho de Melo
2026-08-03 14:41 ` [PATCH 1/2] perf c2c: Fix error masking, OOM, and unchecked caller errors in hpp_list__parse() Arnaldo Carvalho de Melo
2026-08-03 15:02 ` sashiko-bot
2026-08-03 17:14 ` Arnaldo Carvalho de Melo
2026-08-03 12:04 [PATCHES v3 0/2] perf c2c hardening Arnaldo Carvalho de Melo
2026-08-03 12:04 ` [PATCH 1/2] perf c2c: Fix error masking, OOM, and unchecked caller errors in hpp_list__parse() Arnaldo Carvalho de Melo
2026-08-03 12:17 ` sashiko-bot
2026-08-03 1:11 [PATCHES v2 0/2] perf c2c hardening Arnaldo Carvalho de Melo
2026-08-03 1:11 ` [PATCH 1/2] perf c2c: Fix error masking, OOM, and unchecked caller errors in hpp_list__parse() Arnaldo Carvalho de Melo
2026-08-03 1:28 ` sashiko-bot
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=20260804191221.84C921F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=acme@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--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