]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drivers: staging: vme: Fixed the using of sizeof
authorEgor Uleyskiy <egor.ulieiskii@gmail.com>
Sun, 22 Nov 2015 09:27:54 +0000 (11:27 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Nov 2015 23:30:50 +0000 (15:30 -0800)
Constructions that looks like
    card = kzalloc(sizeof(struct pio2_card), GFP_KERNEL);
  are changed to
    card = kzalloc(sizeof(*card), GFP_KERNEL);

Signed-off-by: Egor Uleyskiy <egor.ulieiskii@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vme/devices/vme_pio2_core.c
drivers/staging/vme/devices/vme_user.c

index f3b878b441ee78a6c822027bda99603912e9941f..a30282a57b6bc8d4f1feee2c6b4eb80b4455272d 100644 (file)
@@ -215,7 +215,7 @@ static int pio2_probe(struct vme_dev *vdev)
        u8 reg;
        int vec;
 
-       card = kzalloc(sizeof(struct pio2_card), GFP_KERNEL);
+       card = kzalloc(sizeof(*card), GFP_KERNEL);
        if (!card) {
                retval = -ENOMEM;
                goto err_struct;
index 8e61a3b3e7e4771d445a7bbd5be9d87b5152fd1e..a05a065686de80d6df72a0c99cca9b2ce5e01381 100644 (file)
@@ -308,7 +308,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
                switch (cmd) {
                case VME_IRQ_GEN:
                        copied = copy_from_user(&irq_req, argp,
-                                               sizeof(struct vme_irq_id));
+                                               sizeof(irq_req));
                        if (copied != 0) {
                                pr_warn("Partial copy from userspace\n");
                                return -EFAULT;
@@ -322,7 +322,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
        case MASTER_MINOR:
                switch (cmd) {
                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
                         *      to userspace as they are
@@ -334,7 +334,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
                                                &master.cycle, &master.dwidth);
 
                        copied = copy_to_user(argp, &master,
-                                             sizeof(struct vme_master));
+                                             sizeof(master));
                        if (copied != 0) {
                                pr_warn("Partial copy to userspace\n");
                                return -EFAULT;
@@ -368,7 +368,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
        case SLAVE_MINOR:
                switch (cmd) {
                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
                         *      to userspace as they are
@@ -379,7 +379,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
                                               &slave.aspace, &slave.cycle);
 
                        copied = copy_to_user(argp, &slave,
-                                             sizeof(struct vme_slave));
+                                             sizeof(slave));
                        if (copied != 0) {
                                pr_warn("Partial copy to userspace\n");
                                return -EFAULT;