Skip to content

Commit cb17c1b

Browse files
Al Viromartinkpetersen
authored andcommitted
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/[email protected] Acked-by: Don Brace <[email protected]> Tested-by: Don Brace <[email protected]> Signed-off-by: Al Viro <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 138125f commit cb17c1b

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

drivers/scsi/hpsa.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6619,21 +6619,17 @@ static int hpsa_ioctl(struct scsi_device *dev, unsigned int cmd,
66196619
return rc;
66206620
}
66216621
case CCISS_BIG_PASSTHRU: {
6622-
BIG_IOCTL_Command_struct *ioc;
6622+
BIG_IOCTL_Command_struct ioc;
66236623
if (!argp)
66246624
return -EINVAL;
6625+
if (copy_from_user(&ioc, argp, sizeof(ioc)))
6626+
return -EFAULT;
66256627
if (atomic_dec_if_positive(&h->passthru_cmds_avail) < 0)
66266628
return -EAGAIN;
6627-
ioc = vmemdup_user(argp, sizeof(*ioc));
6628-
if (IS_ERR(ioc)) {
6629-
atomic_inc(&h->passthru_cmds_avail);
6630-
return PTR_ERR(ioc);
6631-
}
6632-
rc = hpsa_big_passthru_ioctl(h, ioc);
6629+
rc = hpsa_big_passthru_ioctl(h, &ioc);
66336630
atomic_inc(&h->passthru_cmds_avail);
6634-
if (!rc && copy_to_user(argp, ioc, sizeof(*ioc)))
6631+
if (!rc && copy_to_user(argp, &ioc, sizeof(ioc)))
66356632
rc = -EFAULT;
6636-
kvfree(ioc);
66376633
return rc;
66386634
}
66396635
default:

0 commit comments

Comments
 (0)