From patchwork Sun Sep 19 03:00:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, Ying" X-Patchwork-Id: 192982 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8J32LFo017737 for ; Sun, 19 Sep 2010 03:02:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754456Ab0ISDBt (ORCPT ); Sat, 18 Sep 2010 23:01:49 -0400 Received: from mga03.intel.com ([143.182.124.21]:29657 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753325Ab0ISDB2 (ORCPT ); Sat, 18 Sep 2010 23:01:28 -0400 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 18 Sep 2010 20:01:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.56,387,1280732400"; d="scan'208";a="326184859" Received: from yhuang-dev.sh.intel.com ([10.239.13.2]) by azsmga001.ch.intel.com with ESMTP; 18 Sep 2010 20:01:27 -0700 From: Huang Ying To: Len Brown Cc: linux-kernel@vger.kernel.org, Andi Kleen , linux-acpi@vger.kernel.org, Yinghai Lu Subject: [PATCH 1/5] ACPI, APEI, Fix APEI related table size checking Date: Sun, 19 Sep 2010 11:00:31 +0800 Message-Id: <1284865235-29920-2-git-send-email-ying.huang@intel.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1284865235-29920-1-git-send-email-ying.huang@intel.com> References: <1284865235-29920-1-git-send-email-ying.huang@intel.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Sun, 19 Sep 2010 03:02:21 +0000 (UTC) diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c index 465c885..b184baa 100644 --- a/drivers/acpi/apei/einj.c +++ b/drivers/acpi/apei/einj.c @@ -426,7 +426,8 @@ DEFINE_SIMPLE_ATTRIBUTE(error_inject_fops, NULL, static int einj_check_table(struct acpi_table_einj *einj_tab) { - if (einj_tab->header_length != sizeof(struct acpi_table_einj)) + if (einj_tab->header_length != + (sizeof(struct acpi_table_einj) - sizeof(einj_tab->header))) return -EINVAL; if (einj_tab->header.length < sizeof(struct acpi_table_einj)) return -EINVAL; diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index a4904f1..40b01c3 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c @@ -750,7 +750,8 @@ __setup("erst_disable", setup_erst_disable); static int erst_check_table(struct acpi_table_erst *erst_tab) { - if (erst_tab->header_length != sizeof(struct acpi_table_erst)) + if (erst_tab->header_length != + (sizeof(struct acpi_table_erst) - sizeof(erst_tab->header))) return -EINVAL; if (erst_tab->header.length < sizeof(struct acpi_table_erst)) return -EINVAL;