From patchwork Tue Mar 19 06:48:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Gong X-Patchwork-Id: 2298881 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 7606FDFB79 for ; Tue, 19 Mar 2013 06:51:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756460Ab3CSGvO (ORCPT ); Tue, 19 Mar 2013 02:51:14 -0400 Received: from mga01.intel.com ([192.55.52.88]:2810 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753868Ab3CSGvO (ORCPT ); Tue, 19 Mar 2013 02:51:14 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 18 Mar 2013 23:51:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,870,1355126400"; d="scan'208";a="304915411" Received: from gchen-sby.bj.intel.com (HELO localhost) ([10.238.158.72]) by fmsmga001.fm.intel.com with ESMTP; 18 Mar 2013 23:51:12 -0700 From: Chen Gong To: ying.huang@intel.com Cc: tony.luck@intel.com, linux-acpi@vger.kernel.org, rjw@sisk.pl, Chen Gong Subject: [PATCH] ACPI/APEI: fix error status check condition for CPER Date: Tue, 19 Mar 2013 02:48:07 -0400 Message-Id: <1363675687-7839-1-git-send-email-gong.chen@linux.intel.com> X-Mailer: git-send-email 1.7.10.4 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org In Table 18-289, ACPI5.0 SPEC, the error data length in CPER Generic Error Data Entry can be 0, which means this generic error data entry can have only one header. So fix the check conditon for it. Signed-off-by: Chen Gong Reviewed-by: Huang Ying --- drivers/acpi/apei/cper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/apei/cper.c b/drivers/acpi/apei/cper.c index 1e5d8a4..fefc2ca 100644 --- a/drivers/acpi/apei/cper.c +++ b/drivers/acpi/apei/cper.c @@ -405,7 +405,7 @@ int apei_estatus_check(const struct acpi_hest_generic_status *estatus) return rc; data_len = estatus->data_length; gdata = (struct acpi_hest_generic_data *)(estatus + 1); - while (data_len > sizeof(*gdata)) { + while (data_len >= sizeof(*gdata)) { gedata_len = gdata->error_data_length; if (gedata_len > data_len - sizeof(*gdata)) return -EINVAL;