From: David Arcari <darcari@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: linux-acpi@vger.kernel.org, David Arcari <darcari@redhat.com>,
Al Stone <ahs3@redhat.com>, Jassi Brar <jassisinghbrar@gmail.com>
Subject: [PATCH] mailbox: PCC: handle parse error
Date: Mon, 27 Aug 2018 15:19:08 -0400 [thread overview]
Message-ID: <1535397548-69588-1-git-send-email-darcari@redhat.com> (raw)
acpi_pcc_probe calls acpi_table_parse_entries_array but fails to check
for an error return. This in turn can result in calling kcalloc with
a negative count as well as emitting the following misleading erorr
message:
[ 2.642015] Could not allocate space for PCC mbox channels
Fixes: 8f8027c5f935 ("mailbox: PCC: erroneous error message when parsing ACPI PCCT")
Signed-off-by: David Arcari <darcari@redhat.com>
Cc: Al Stone <ahs3@redhat.com>
Cc: Jassi Brar <jassisinghbrar@gmail.com>
---
drivers/mailbox/pcc.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c
index 311e91b..256f18b 100644
--- a/drivers/mailbox/pcc.c
+++ b/drivers/mailbox/pcc.c
@@ -461,8 +461,11 @@ static int __init acpi_pcc_probe(void)
count = acpi_table_parse_entries_array(ACPI_SIG_PCCT,
sizeof(struct acpi_table_pcct), proc,
ACPI_PCCT_TYPE_RESERVED, MAX_PCC_SUBSPACES);
- if (count == 0 || count > MAX_PCC_SUBSPACES) {
- pr_warn("Invalid PCCT: %d PCC subspaces\n", count);
+ if (count <= 0 || count > MAX_PCC_SUBSPACES) {
+ if (count < 0)
+ pr_warn("Error parsing PCC subspaces from PCCT\n");
+ else
+ pr_warn("Invalid PCCT: %d PCC subspaces\n", count);
return -EINVAL;
}
--
1.8.3.1
next reply other threads:[~2018-08-27 19:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-27 19:19 David Arcari [this message]
2018-08-27 20:55 ` [PATCH] mailbox: PCC: handle parse error Al Stone
2018-09-14 8:41 ` Rafael J. Wysocki
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=1535397548-69588-1-git-send-email-darcari@redhat.com \
--to=darcari@redhat.com \
--cc=ahs3@redhat.com \
--cc=jassisinghbrar@gmail.com \
--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;
as well as URLs for NNTP newsgroup(s).