Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754196AbZJLHLQ (ORCPT ); Mon, 12 Oct 2009 03:11:16 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753753AbZJLHLQ (ORCPT ); Mon, 12 Oct 2009 03:11:16 -0400 Received: from g6t0184.atlanta.hp.com ([15.193.32.61]:30165 "EHLO g6t0184.atlanta.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753612AbZJLHLP (ORCPT ); Mon, 12 Oct 2009 03:11:15 -0400 X-Greylist: delayed 453 seconds by postgrey-1.27 at vger.kernel.org; Mon, 12 Oct 2009 03:11:15 EDT Subject: [PATCH 3/5] PCI: maintain backwards compatibility with aer-inject user-land tool To: ying.huang@intel.com From: Andrew Patterson Cc: prarit@redhat.com, andi@firstfloor.org, linux-kernel@vger.kernel.org, jbarnes@virtuousgeek.org, pci-linux@vger.kernel.org Date: Mon, 12 Oct 2009 01:03:04 -0600 Message-ID: <20091012070304.27029.14815.stgit@bob.kio> In-Reply-To: <20091012070248.27029.78378.stgit@bob.kio> References: <20091012070248.27029.78378.stgit@bob.kio> User-Agent: StGit/0.14.3.386.gb02d MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1409 Lines: 52 PCI: maintain backwards compatibility with aer-inject user-land tool Maintain backwards compatibility with the 0.1 version of the aer-inject user-land tool. Signed-off-by: Andrew Patterson --- diff --git a/drivers/pci/pcie/aer/aer_inject.c b/drivers/pci/pcie/aer/aer_inject.c index 5fc5b3e..ac0b5e7 100644 --- a/drivers/pci/pcie/aer/aer_inject.c +++ b/drivers/pci/pcie/aer/aer_inject.c @@ -23,10 +23,10 @@ #include #include #include +#include #include "aerdrv.h" struct aer_error_inj { - u16 domain; u8 bus; u8 dev; u8 fn; @@ -36,6 +36,7 @@ struct aer_error_inj { u32 header_log1; u32 header_log2; u32 header_log3; + u16 domain; }; struct aer_error { @@ -431,10 +432,11 @@ static ssize_t aer_inject_write(struct file *filp, const char __user *ubuf, if (!capable(CAP_SYS_ADMIN)) return -EPERM; - - if (usize != sizeof(struct aer_error_inj)) + if (usize < offsetof(struct aer_error_inj, domain) || + usize > sizeof(einj)) return -EINVAL; + memset(&einj, 0, sizeof(einj)); if (copy_from_user(&einj, ubuf, usize)) return -EFAULT; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/