mirror of https://gitee.com/openkylin/linux.git
mailbox: PCC: handle parse error
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: 8f8027c5f9
(mailbox: PCC: erroneous error message when parsing ACPI PCCT)
Signed-off-by: David Arcari <darcari@redhat.com>
Reviewed-by: Al Stone <ahs3@redhat.com>
Cc: 4.18+ <stable@vger.kernel.org> # 4.18+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
11da3a7f84
commit
afd0b1fb22
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue