[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091012070304.27029.14815.stgit@bob.kio>
Date: Mon, 12 Oct 2009 01:03:04 -0600
From: Andrew Patterson <andrew.patterson@...com>
To: ying.huang@...el.com
Cc: prarit@...hat.com, andi@...stfloor.org,
linux-kernel@...r.kernel.org, jbarnes@...tuousgeek.org,
pci-linux@...r.kernel.org
Subject: [PATCH 3/5] PCI: maintain backwards compatibility with aer-inject
user-land tool
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<andrew.patterson@...com>
---
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 <linux/pci.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
+#include <linux/stddef.h>
#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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists