Messages in this thread | | | From | Joel Stanley <> | Date | Fri, 17 Feb 2017 13:12:17 +1030 | Subject | Re: [PATCH v5] drivers/misc: Add Aspeed LPC control driver |
| |
On Tue, Feb 14, 2017 at 5:00 PM, Cyril Bur <cyrilbur@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
| |