/* Copy parameter control struct, including a possible path allocated at the end of the struct.  */
static struct autofs_dev_ioctl* copy_dev_ioctl(struct autofs_dev_ioctl __user *in)
/* Copy parameter control struct, including a possible path allocated at the end of the struct.  */
static struct autofs_dev_ioctl* copy_dev_ioctl(struct autofs_dev_ioctl __user *in)
{
	struct autofs_dev_ioctl tmp, *ads;
	if (copy_from_user(&tmp, in, sizeof(tmp)))
		return ERR_PTR(-EFAULT);
	if (tmp.size < sizeof(tmp))
		return ERR_PTR(-EINVAL);
	ads = kmalloc(tmp.size, GFP_KERNEL);
	if (!ads)
		return ERR_PTR(-ENOMEM);
	if (copy_from_user(ads, in, tmp.size)) {
		kfree(ads);
		return ERR_PTR(-EFAULT);
	}
	return ads;
}