[PATCH v5] drivers/misc: Add Aspeed LPC control driver

Joel Stanley joel at jms.id.au
Fri Feb 17 13:42:17 AEDT 2017


On Tue, Feb 14, 2017 at 5:00 PM, Cyril Bur <cyrilbur at gmail.com> wrote:
> diff --git a/drivers/misc/aspeed-lpc-ctrl.c b/drivers/misc/aspeed-lpc-ctrl.c
> new file mode 100644
> index 000000000000..9b51548e9d81
> --- /dev/null
> +++ b/drivers/misc/aspeed-lpc-ctrl.c

> +static long aspeed_lpc_ctrl_ioctl(struct file *file, unsigned int cmd,
> +               unsigned long param)
> +{
> +       struct aspeed_lpc_ctrl *lpc_ctrl = file_aspeed_lpc_ctrl(file);
> +       void __user *p = (void __user *)param;
> +       struct aspeed_lpc_ctrl_mapping map;
> +       u32 addr;
> +       u32 size;
> +       long rc;
> +
> +       if (copy_from_user(&map, p, sizeof(map)))
> +               return -EFAULT;

The structure you pass has a flags field that is currently unused. You
should check the value of map->flags here and reject non-zero values.

Once you fix that I think it's in good shape.

Cheers,

Joel


More information about the openbmc mailing list