Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Egor Uleyskiy <egor.ulieiskii@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Egor Uleyskiy and committed by
Greg Kroah-Hartman
93a28666 cad5636d

+6 -6
+1 -1
drivers/staging/vme/devices/vme_pio2_core.c
··· 215 215 u8 reg; 216 216 int vec; 217 217 218 - card = kzalloc(sizeof(struct pio2_card), GFP_KERNEL); 218 + card = kzalloc(sizeof(*card), GFP_KERNEL); 219 219 if (!card) { 220 220 retval = -ENOMEM; 221 221 goto err_struct;
+5 -5
drivers/staging/vme/devices/vme_user.c
··· 308 308 switch (cmd) { 309 309 case VME_IRQ_GEN: 310 310 copied = copy_from_user(&irq_req, argp, 311 - sizeof(struct vme_irq_id)); 311 + sizeof(irq_req)); 312 312 if (copied != 0) { 313 313 pr_warn("Partial copy from userspace\n"); 314 314 return -EFAULT; ··· 322 322 case MASTER_MINOR: 323 323 switch (cmd) { 324 324 case VME_GET_MASTER: 325 - memset(&master, 0, sizeof(struct vme_master)); 325 + memset(&master, 0, sizeof(master)); 326 326 327 327 /* XXX We do not want to push aspace, cycle and width 328 328 * to userspace as they are ··· 334 334 &master.cycle, &master.dwidth); 335 335 336 336 copied = copy_to_user(argp, &master, 337 - sizeof(struct vme_master)); 337 + sizeof(master)); 338 338 if (copied != 0) { 339 339 pr_warn("Partial copy to userspace\n"); 340 340 return -EFAULT; ··· 368 368 case SLAVE_MINOR: 369 369 switch (cmd) { 370 370 case VME_GET_SLAVE: 371 - memset(&slave, 0, sizeof(struct vme_slave)); 371 + memset(&slave, 0, sizeof(slave)); 372 372 373 373 /* XXX We do not want to push aspace, cycle and width 374 374 * to userspace as they are ··· 379 379 &slave.aspace, &slave.cycle); 380 380 381 381 copied = copy_to_user(argp, &slave, 382 - sizeof(struct vme_slave)); 382 + sizeof(slave)); 383 383 if (copied != 0) { 384 384 pr_warn("Partial copy to userspace\n"); 385 385 return -EFAULT;