scsi: hpsa: Don't bother with vmalloc for BIG_IOCTL_Command_struct

"BIG" in the name refers to the amount of data being transferred, _not_ the
size of structure itself; it's 140 or 144 bytes (for 32bit and 64bit hosts
resp.).  IOCTL_Command_struct is 136 or 144 bytes large...

No point whatsoever turning that into dynamic allocation, let alone vmalloc
one.  Just keep it as local variable...

Link: https://lore.kernel.org/r/20200529234028.46373-2-viro@ZenIV.linux.org.uk
Acked-by: Don Brace <don.brace@microsemi.com>
Tested-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Al Viro 2020-05-30 00:40:26 +01:00 коммит произвёл Martin K. Petersen
Родитель 138125f74b
Коммит cb17c1b69b
1 изменённых файлов: 5 добавлений и 9 удалений

Просмотреть файл

@ -6619,21 +6619,17 @@ static int hpsa_ioctl(struct scsi_device *dev, unsigned int cmd,
return rc; return rc;
} }
case CCISS_BIG_PASSTHRU: { case CCISS_BIG_PASSTHRU: {
BIG_IOCTL_Command_struct *ioc; BIG_IOCTL_Command_struct ioc;
if (!argp) if (!argp)
return -EINVAL; return -EINVAL;
if (copy_from_user(&ioc, argp, sizeof(ioc)))
return -EFAULT;
if (atomic_dec_if_positive(&h->passthru_cmds_avail) < 0) if (atomic_dec_if_positive(&h->passthru_cmds_avail) < 0)
return -EAGAIN; return -EAGAIN;
ioc = vmemdup_user(argp, sizeof(*ioc)); rc = hpsa_big_passthru_ioctl(h, &ioc);
if (IS_ERR(ioc)) {
atomic_inc(&h->passthru_cmds_avail); atomic_inc(&h->passthru_cmds_avail);
return PTR_ERR(ioc); if (!rc && copy_to_user(argp, &ioc, sizeof(ioc)))
}
rc = hpsa_big_passthru_ioctl(h, ioc);
atomic_inc(&h->passthru_cmds_avail);
if (!rc && copy_to_user(argp, ioc, sizeof(*ioc)))
rc = -EFAULT; rc = -EFAULT;
kvfree(ioc);
return rc; return rc;
} }
default: default: