Commit 93a28666 authored by Egor Uleyskiy's avatar Egor Uleyskiy Committed by Greg Kroah-Hartman

drivers: staging: vme: Fixed the using of sizeof

Constructions that looks like
    card = kzalloc(sizeof(struct pio2_card), GFP_KERNEL);
  are changed to
    card = kzalloc(sizeof(*card), GFP_KERNEL);
Signed-off-by: default avatarEgor Uleyskiy <egor.ulieiskii@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cad5636d
...@@ -215,7 +215,7 @@ static int pio2_probe(struct vme_dev *vdev) ...@@ -215,7 +215,7 @@ static int pio2_probe(struct vme_dev *vdev)
u8 reg; u8 reg;
int vec; int vec;
card = kzalloc(sizeof(struct pio2_card), GFP_KERNEL); card = kzalloc(sizeof(*card), GFP_KERNEL);
if (!card) { if (!card) {
retval = -ENOMEM; retval = -ENOMEM;
goto err_struct; goto err_struct;
......
...@@ -308,7 +308,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, ...@@ -308,7 +308,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
switch (cmd) { switch (cmd) {
case VME_IRQ_GEN: case VME_IRQ_GEN:
copied = copy_from_user(&irq_req, argp, copied = copy_from_user(&irq_req, argp,
sizeof(struct vme_irq_id)); sizeof(irq_req));
if (copied != 0) { if (copied != 0) {
pr_warn("Partial copy from userspace\n"); pr_warn("Partial copy from userspace\n");
return -EFAULT; return -EFAULT;
...@@ -322,7 +322,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, ...@@ -322,7 +322,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
case MASTER_MINOR: case MASTER_MINOR:
switch (cmd) { switch (cmd) {
case VME_GET_MASTER: case VME_GET_MASTER:
memset(&master, 0, sizeof(struct vme_master)); memset(&master, 0, sizeof(master));
/* XXX We do not want to push aspace, cycle and width /* XXX We do not want to push aspace, cycle and width
* to userspace as they are * to userspace as they are
...@@ -334,7 +334,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, ...@@ -334,7 +334,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
&master.cycle, &master.dwidth); &master.cycle, &master.dwidth);
copied = copy_to_user(argp, &master, copied = copy_to_user(argp, &master,
sizeof(struct vme_master)); sizeof(master));
if (copied != 0) { if (copied != 0) {
pr_warn("Partial copy to userspace\n"); pr_warn("Partial copy to userspace\n");
return -EFAULT; return -EFAULT;
...@@ -368,7 +368,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, ...@@ -368,7 +368,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
case SLAVE_MINOR: case SLAVE_MINOR:
switch (cmd) { switch (cmd) {
case VME_GET_SLAVE: case VME_GET_SLAVE:
memset(&slave, 0, sizeof(struct vme_slave)); memset(&slave, 0, sizeof(slave));
/* XXX We do not want to push aspace, cycle and width /* XXX We do not want to push aspace, cycle and width
* to userspace as they are * to userspace as they are
...@@ -379,7 +379,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, ...@@ -379,7 +379,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
&slave.aspace, &slave.cycle); &slave.aspace, &slave.cycle);
copied = copy_to_user(argp, &slave, copied = copy_to_user(argp, &slave,
sizeof(struct vme_slave)); sizeof(slave));
if (copied != 0) { if (copied != 0) {
pr_warn("Partial copy to userspace\n"); pr_warn("Partial copy to userspace\n");
return -EFAULT; return -EFAULT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment