From: sashiko-bot@kernel.org
To: "Pan Chuang" <panchuang@vivo.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 3/3] drivers/perf: hisi: Remove redundant dev_err()/dev_err_probe()
Date: Fri, 17 Jul 2026 10:40:57 +0000 [thread overview]
Message-ID: <20260717104057.C8A5C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260717103123.34887-4-panchuang@vivo.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Out-of-bounds array access / buffer overflow in hisi_l3c_pmu_init_ext() due to missing upper bound check on device tree IRQ count.
--
--- Patch [3]: [PATCH 3/3] drivers/perf: hisi: Remove redundant dev_err()/dev_err_probe() ---
commit 439e35f073703c68b0687dec637faec43876da5e
Author: Pan Chuang <panchuang@vivo.com>
drivers/perf: hisi: Remove redundant dev_err()/dev_err_probe()
This commit removes redundant driver-specific error logs when calling
devm_request_irq(). The core framework automatically handles the error
reporting on failure.
> diff --git a/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c b/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c
> index f963e4f9e5527..56a88fb0d3c2c 100644
> --- a/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c
> +++ b/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c
> @@ -604,8 +604,7 @@ static int hisi_l3c_pmu_init_ext(struct hisi_pmu *l3c_pmu, struct platform_devic
> IRQF_NOBALANCING | IRQF_NO_THREAD,
> irqname, l3c_pmu);
> if (ret < 0)
> - return dev_err_probe(&pdev->dev, ret,
> - "Fail to request EXT IRQ: %d.\n", irq);
> + return ret;
>
> hisi_l3c_pmu->ext_irq[i] = irq;
[Severity: High]
This is a pre-existing issue, but does this loop risk writing out of bounds
if the device tree specifies more IRQs than expected?
In hisi_l3c_pmu_init_ext(), the total number of IRQs is fetched with
platform_irq_count(pdev). The code enforces a lower bound but misses an
upper bound check:
ext_num = platform_irq_count(pdev);
if (ext_num < L3C_MAX_EXT)
return -ENODEV;
hisi_l3c_pmu->ext_num = ext_num - 1;
If a misconfigured device tree provides more IRQs than expected,
hisi_l3c_pmu->ext_num can exceed the fixed size of the ext_base and ext_irq
arrays, which are bound by L3C_MAX_EXT.
The loop iterating up to hisi_l3c_pmu->ext_num would then write out of
bounds into the ext_irq array at the end of this block.
Could we add an upper bound check for ext_num to prevent memory corruption
if too many IRQs are present?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260717103123.34887-1-panchuang@vivo.com?part=3
prev parent reply other threads:[~2026-07-17 10:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 10:31 [PATCH 0/3] perf: Remove redundant error messages on IRQ request failure Pan Chuang
2026-07-17 10:31 ` [PATCH 1/3] perf: Remove redundant dev_err()/dev_err_probe() Pan Chuang
2026-07-17 10:43 ` sashiko-bot
2026-07-17 11:06 ` Xu Yang
2026-07-17 16:00 ` Frank Li
2026-07-17 10:31 ` [PATCH 2/3] perf: arm_cspmu: Remove redundant dev_err() Pan Chuang
2026-07-17 10:31 ` [PATCH 3/3] drivers/perf: hisi: Remove redundant dev_err()/dev_err_probe() Pan Chuang
2026-07-17 10:40 ` 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=20260717104057.C8A5C1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=panchuang@vivo.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