Re: [PATCH 3/5] PCI: maintain backwards compatibility withaer-inject user-land tool

From: Huang Ying
Date: Mon Oct 12 2009 - 03:50:43 EST


On Mon, 2009-10-12 at 15:03 +0800, Andrew Patterson wrote:
> 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@xxxxxx>
> ---
>
> 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;
>

Why not merge this patch with [2/5]?

Best Regards,
Huang Ying


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/