From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Cc: Len Brown <lenb@kernel.org>,
George Cherian <george.cherian@cavium.com>,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ACPI / CPPC: Fix negative array index read in cppc_set_perf
Date: Sat, 16 Dec 2017 02:47:30 +0100 [thread overview]
Message-ID: <1775451.pdUQMu89xf@aspire.rjw.lan> (raw)
In-Reply-To: <20171213224541.GA31477@embeddedor.com>
On Wednesday, December 13, 2017 11:45:41 PM CET Gustavo A. R. Silva wrote:
> If pcc_ss_id is less than 0, there is a negative array index read
> before verifying pcc_ss_id is not a negative value.
>
> Fix this by removing the code that triggers this issue.
>
> Notice that this code is already properly placed after the check
> on pcc_ss_id at line 1182: pcc_ss_data = pcc_data[pcc_ss_id];
>
> Addresses-Coverity-ID: 1426090 ("Negative array index read")
> Fixes: 1ecbd7170d65 ("ACPI / CPPC: Fix KASAN global out of bounds warning")
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---
> drivers/acpi/cppc_acpi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
> index 30e84cc..06ea474 100644
> --- a/drivers/acpi/cppc_acpi.c
> +++ b/drivers/acpi/cppc_acpi.c
> @@ -1171,7 +1171,7 @@ int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls)
> struct cpc_desc *cpc_desc = per_cpu(cpc_desc_ptr, cpu);
> struct cpc_register_resource *desired_reg;
> int pcc_ss_id = per_cpu(cpu_pcc_subspace_idx, cpu);
> - struct cppc_pcc_data *pcc_ss_data = pcc_data[pcc_ss_id];
> + struct cppc_pcc_data *pcc_ss_data;
> int ret = 0;
>
> if (!cpc_desc || pcc_ss_id < 0) {
>
I applied a patch from Coling Ian King that did the same thing and was
posted eaelier.
Thanks,
Rafael
prev parent reply other threads:[~2017-12-16 1:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-13 22:45 Gustavo A. R. Silva
2017-12-15 18:18 ` George Cherian
2017-12-16 1:47 ` Rafael J. Wysocki [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=1775451.pdUQMu89xf@aspire.rjw.lan \
--to=rjw@rjwysocki.net \
--cc=garsilva@embeddedor.com \
--cc=george.cherian@cavium.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®