Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp6253185imm; Mon, 27 Aug 2018 12:21:38 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbfY5ZEL57WfFgu3df6lmRQoRtBDT/7QmMPEHf4zO436aPPmb9uDD8k04gaxvVgtUO0DuEl X-Received: by 2002:a17:902:1ab:: with SMTP id b40-v6mr14715396plb.55.1535397698197; Mon, 27 Aug 2018 12:21:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535397698; cv=none; d=google.com; s=arc-20160816; b=LV6GcM6IPH1d433okjUW/P87A+Ea99Lq2F6FA77b38xff3nyrNvmJh9pyuI2w2NuUc VR9mwv5PvWl3OlQmqiRk+lfuubSWXtp0V23hRUwg4/LzTpjD1p598REqkaCPTooY5Czv q0zpfDJdogZTqbtWKMIyNIooynWyOz8gGhvq+E1m0JU7nOSx08wssQKYyx57u0r6ZCvi s9fwzc9KHtb+n+3uxPgyMFqjIH2V3WFJfxARJe4uL4tQcKRtm/SvGFGn05qPXG93uAtP 81z4UWLA3rE4jt+vwAnM3IUNScP3/8Rj0Ebot41dqGfFnGN2rvSHIfSi+Jxiv+efZfkX C0yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Gs52EiwcptZc3/YkdWfMVS2S7ndg8k6bwu/pKscZigw=; b=EjuLwn/v9M6vs+nkIbnOSRcfztRzTkbDKcydoKhP+lmfE2P/E/c8UGHbd0EwdhTqUr peXJ22cde1rP9AyjbeVQlMZulnArvESKRN5LuvrCXC0gCUKgWIs2eJqAtmfagQyPtLvp bq7W7Sg0nUO0lMgKlYPlp+UV/7SHwDhiJcinLZ0Gp5b3oFtTvcwhb5sfPVFP2vpnAMEp 3l8F4QLHLgYylbYWN9b1B65pxrb7fjGG3x7oGOoUxBpFNLA4zm4UzLzXA7v72lTFSDyn VnribDCJLV58AZukxIuVYYxdfejezYHSSxhMP8w6VVcoYDResNjbBSK442Gv+1ea826y chaQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g12-v6si21464pla.70.2018.08.27.12.21.22; Mon, 27 Aug 2018 12:21:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727223AbeH0XIB (ORCPT + 99 others); Mon, 27 Aug 2018 19:08:01 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:37752 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726939AbeH0XIA (ORCPT ); Mon, 27 Aug 2018 19:08:00 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F35E6400738B; Mon, 27 Aug 2018 19:20:05 +0000 (UTC) Received: from dba62.ml3.eng.bos.redhat.com (dba62.ml3.eng.bos.redhat.com [10.19.176.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id D75E52166B41; Mon, 27 Aug 2018 19:20:03 +0000 (UTC) From: David Arcari To: linux-kernel@vger.kernel.org Cc: linux-acpi@vger.kernel.org, David Arcari , Al Stone , Jassi Brar Subject: [PATCH] mailbox: PCC: handle parse error Date: Mon, 27 Aug 2018 15:19:08 -0400 Message-Id: <1535397548-69588-1-git-send-email-darcari@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 27 Aug 2018 19:20:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 27 Aug 2018 19:20:06 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'darcari@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: Al Stone Cc: Jassi Brar --- 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