From: James Clark <james.clark@linaro.org>
To: Dan Carpenter <error27@gmail.com>, Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Guo Ren <guoren@kernel.org>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-csky@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] perf dwarf-regs: Fix off by one in __get_dwarf_regnum_for_perf_regnum_csky()
Date: Thu, 23 Apr 2026 10:13:22 +0100 [thread overview]
Message-ID: <204607f3-16fc-4be8-91ac-bf38c6dc31f9@linaro.org> (raw)
In-Reply-To: <aenDmXNIKdwdtMzn@stanley.mountain>
On 23/04/2026 08:00, Dan Carpenter wrote:
> Change the > comparison >= to prevent an out of bounds access of
> the dwarf_csky_regnumsp[] array.
>
> Fixes: 8cac4013b0c2 ("perf dwarf-regs: Add csky perf to dwarf register number mapping functions")
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
> ---
> tools/perf/util/dwarf-regs-arch/dwarf-regs-csky.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/dwarf-regs-arch/dwarf-regs-csky.c b/tools/perf/util/dwarf-regs-arch/dwarf-regs-csky.c
> index cb44b774f8d9..4c586a5cb763 100644
> --- a/tools/perf/util/dwarf-regs-arch/dwarf-regs-csky.c
> +++ b/tools/perf/util/dwarf-regs-arch/dwarf-regs-csky.c
> @@ -118,7 +118,7 @@ int __get_dwarf_regnum_for_perf_regnum_csky(int perf_regnum, unsigned int flags)
> if (flags & EF_CSKY_ABIV2)
> idx++;
>
> - if (perf_regnum < 0 || perf_regnum > (int)ARRAY_SIZE(dwarf_csky_regnums) ||
> + if (perf_regnum < 0 || perf_regnum >= (int)ARRAY_SIZE(dwarf_csky_regnums) ||
> dwarf_csky_regnums[perf_regnum][idx] == 0)
> return -ENOENT;
>
Reviewed-by: James Clark <james.clark@linaro.org>
prev parent reply other threads:[~2026-04-23 9:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-23 7:00 [PATCH] perf dwarf-regs: Fix off by one in __get_dwarf_regnum_for_perf_regnum_csky() Dan Carpenter
2026-04-23 9:13 ` James Clark [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=204607f3-16fc-4be8-91ac-bf38c6dc31f9@linaro.org \
--to=james.clark@linaro.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=error27@gmail.com \
--cc=guoren@kernel.org \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-csky@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/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