aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/kvm_main.c
diff options
context:
space:
mode:
authorXiubo Li <lixiubo@cmss.chinamobile.com>2015-02-26 01:58:19 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2015-03-10 09:37:43 -0400
commit893bdbf16574e781504ea2a767ff8919d1394e52 (patch)
tree7bbf7de4d0ae552be5d664dd1bd3ed80a398c663 /virt/kvm/kvm_main.c
parent548ef28449c0c06f92194c40ff0eaed248cb4b75 (diff)
KVM: Fix WARNINGs for 'sizeof(X)' instead of 'sizeof X' in kvm_main.c
There are many WARNINGs like this: WARNING: sizeof tr should be sizeof(tr) + if (copy_from_user(&tr, argp, sizeof tr)) In kvm_main.c many places are using 'sizeof(X)', and the other places are using 'sizeof X', while the kernel recommands to use 'sizeof(X)', so this patch will replace all 'sizeof X' to 'sizeof(X)' to make them consistent and at the same time to reduce the WARNINGs noise when we are checking new patches. Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'virt/kvm/kvm_main.c')
-rw-r--r--virt/kvm/kvm_main.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 07064dc18f97..38738c20992e 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2197,7 +2197,7 @@ out_free1:
2197 if (r) 2197 if (r)
2198 goto out; 2198 goto out;
2199 r = -EFAULT; 2199 r = -EFAULT;
2200 if (copy_to_user(argp, &mp_state, sizeof mp_state)) 2200 if (copy_to_user(argp, &mp_state, sizeof(mp_state)))
2201 goto out; 2201 goto out;
2202 r = 0; 2202 r = 0;
2203 break; 2203 break;
@@ -2206,7 +2206,7 @@ out_free1:
2206 struct kvm_mp_state mp_state; 2206 struct kvm_mp_state mp_state;
2207 2207
2208 r = -EFAULT; 2208 r = -EFAULT;
2209 if (copy_from_user(&mp_state, argp, sizeof mp_state)) 2209 if (copy_from_user(&mp_state, argp, sizeof(mp_state)))
2210 goto out; 2210 goto out;
2211 r = kvm_arch_vcpu_ioctl_set_mpstate(vcpu, &mp_state); 2211 r = kvm_arch_vcpu_ioctl_set_mpstate(vcpu, &mp_state);
2212 break; 2212 break;
@@ -2215,13 +2215,13 @@ out_free1:
2215 struct kvm_translation tr; 2215 struct kvm_translation tr;
2216 2216
2217 r = -EFAULT; 2217 r = -EFAULT;
2218 if (copy_from_user(&tr, argp, sizeof tr)) 2218 if (copy_from_user(&tr, argp, sizeof(tr)))
2219 goto out; 2219 goto out;
2220 r = kvm_arch_vcpu_ioctl_translate(vcpu, &tr); 2220 r = kvm_arch_vcpu_ioctl_translate(vcpu, &tr);
2221 if (r) 2221 if (r)
2222 goto out; 2222 goto out;
2223 r = -EFAULT; 2223 r = -EFAULT;
2224 if (copy_to_user(argp, &tr, sizeof tr)) 2224 if (copy_to_user(argp, &tr, sizeof(tr)))
2225 goto out; 2225 goto out;
2226 r = 0; 2226 r = 0;
2227 break; 2227 break;
@@ -2230,7 +2230,7 @@ out_free1:
2230 struct kvm_guest_debug dbg; 2230 struct kvm_guest_debug dbg;
2231 2231
2232 r = -EFAULT; 2232 r = -EFAULT;
2233 if (copy_from_user(&dbg, argp, sizeof dbg)) 2233 if (copy_from_user(&dbg, argp, sizeof(dbg)))
2234 goto out; 2234 goto out;
2235 r = kvm_arch_vcpu_ioctl_set_guest_debug(vcpu, &dbg); 2235 r = kvm_arch_vcpu_ioctl_set_guest_debug(vcpu, &dbg);
2236 break; 2236 break;
@@ -2244,14 +2244,14 @@ out_free1:
2244 if (argp) { 2244 if (argp) {
2245 r = -EFAULT; 2245 r = -EFAULT;
2246 if (copy_from_user(&kvm_sigmask, argp, 2246 if (copy_from_user(&kvm_sigmask, argp,
2247 sizeof kvm_sigmask)) 2247 sizeof(kvm_sigmask)))
2248 goto out; 2248 goto out;
2249 r = -EINVAL; 2249 r = -EINVAL;
2250 if (kvm_sigmask.len != sizeof sigset) 2250 if (kvm_sigmask.len != sizeof(sigset))
2251 goto out; 2251 goto out;
2252 r = -EFAULT; 2252 r = -EFAULT;
2253 if (copy_from_user(&sigset, sigmask_arg->sigset, 2253 if (copy_from_user(&sigset, sigmask_arg->sigset,
2254 sizeof sigset)) 2254 sizeof(sigset)))
2255 goto out; 2255 goto out;
2256 p = &sigset; 2256 p = &sigset;
2257 } 2257 }
@@ -2313,14 +2313,14 @@ static long kvm_vcpu_compat_ioctl(struct file *filp,
2313 if (argp) { 2313 if (argp) {
2314 r = -EFAULT; 2314 r = -EFAULT;
2315 if (copy_from_user(&kvm_sigmask, argp, 2315 if (copy_from_user(&kvm_sigmask, argp,
2316 sizeof kvm_sigmask)) 2316 sizeof(kvm_sigmask)))
2317 goto out; 2317 goto out;
2318 r = -EINVAL; 2318 r = -EINVAL;
2319 if (kvm_sigmask.len != sizeof csigset) 2319 if (kvm_sigmask.len != sizeof(csigset))
2320 goto out; 2320 goto out;
2321 r = -EFAULT; 2321 r = -EFAULT;
2322 if (copy_from_user(&csigset, sigmask_arg->sigset, 2322 if (copy_from_user(&csigset, sigmask_arg->sigset,
2323 sizeof csigset)) 2323 sizeof(csigset)))
2324 goto out; 2324 goto out;
2325 sigset_from_compat(&sigset, &csigset); 2325 sigset_from_compat(&sigset, &csigset);
2326 r = kvm_vcpu_ioctl_set_sigmask(vcpu, &sigset); 2326 r = kvm_vcpu_ioctl_set_sigmask(vcpu, &sigset);
@@ -2516,7 +2516,7 @@ static long kvm_vm_ioctl(struct file *filp,
2516 2516
2517 r = -EFAULT; 2517 r = -EFAULT;
2518 if (copy_from_user(&kvm_userspace_mem, argp, 2518 if (copy_from_user(&kvm_userspace_mem, argp,
2519 sizeof kvm_userspace_mem)) 2519 sizeof(kvm_userspace_mem)))
2520 goto out; 2520 goto out;
2521 2521
2522 r = kvm_vm_ioctl_set_memory_region(kvm, &kvm_userspace_mem); 2522 r = kvm_vm_ioctl_set_memory_region(kvm, &kvm_userspace_mem);
@@ -2526,7 +2526,7 @@ static long kvm_vm_ioctl(struct file *filp,
2526 struct kvm_dirty_log log; 2526 struct kvm_dirty_log log;
2527 2527
2528 r = -EFAULT; 2528 r = -EFAULT;
2529 if (copy_from_user(&log, argp, sizeof log)) 2529 if (copy_from_user(&log, argp, sizeof(log)))
2530 goto out; 2530 goto out;
2531 r = kvm_vm_ioctl_get_dirty_log(kvm, &log); 2531 r = kvm_vm_ioctl_get_dirty_log(kvm, &log);
2532 break; 2532 break;
@@ -2535,7 +2535,7 @@ static long kvm_vm_ioctl(struct file *filp,
2535 case KVM_REGISTER_COALESCED_MMIO: { 2535 case KVM_REGISTER_COALESCED_MMIO: {
2536 struct kvm_coalesced_mmio_zone zone; 2536 struct kvm_coalesced_mmio_zone zone;
2537 r = -EFAULT; 2537 r = -EFAULT;
2538 if (copy_from_user(&zone, argp, sizeof zone)) 2538 if (copy_from_user(&zone, argp, sizeof(zone)))
2539 goto out; 2539 goto out;
2540 r = kvm_vm_ioctl_register_coalesced_mmio(kvm, &zone); 2540 r = kvm_vm_ioctl_register_coalesced_mmio(kvm, &zone);
2541 break; 2541 break;
@@ -2543,7 +2543,7 @@ static long kvm_vm_ioctl(struct file *filp,
2543 case KVM_UNREGISTER_COALESCED_MMIO: { 2543 case KVM_UNREGISTER_COALESCED_MMIO: {
2544 struct kvm_coalesced_mmio_zone zone; 2544 struct kvm_coalesced_mmio_zone zone;
2545 r = -EFAULT; 2545 r = -EFAULT;
2546 if (copy_from_user(&zone, argp, sizeof zone)) 2546 if (copy_from_user(&zone, argp, sizeof(zone)))
2547 goto out; 2547 goto out;
2548 r = kvm_vm_ioctl_unregister_coalesced_mmio(kvm, &zone); 2548 r = kvm_vm_ioctl_unregister_coalesced_mmio(kvm, &zone);
2549 break; 2549 break;
@@ -2553,7 +2553,7 @@ static long kvm_vm_ioctl(struct file *filp,
2553 struct kvm_irqfd data; 2553 struct kvm_irqfd data;
2554 2554
2555 r = -EFAULT; 2555 r = -EFAULT;
2556 if (copy_from_user(&data, argp, sizeof data)) 2556 if (copy_from_user(&data, argp, sizeof(data)))
2557 goto out; 2557 goto out;
2558 r = kvm_irqfd(kvm, &data); 2558 r = kvm_irqfd(kvm, &data);
2559 break; 2559 break;
@@ -2562,7 +2562,7 @@ static long kvm_vm_ioctl(struct file *filp,
2562 struct kvm_ioeventfd data; 2562 struct kvm_ioeventfd data;
2563 2563
2564 r = -EFAULT; 2564 r = -EFAULT;
2565 if (copy_from_user(&data, argp, sizeof data)) 2565 if (copy_from_user(&data, argp, sizeof(data)))
2566 goto out; 2566 goto out;
2567 r = kvm_ioeventfd(kvm, &data); 2567 r = kvm_ioeventfd(kvm, &data);
2568 break; 2568 break;
@@ -2583,7 +2583,7 @@ static long kvm_vm_ioctl(struct file *filp,
2583 struct kvm_msi msi; 2583 struct kvm_msi msi;
2584 2584
2585 r = -EFAULT; 2585 r = -EFAULT;
2586 if (copy_from_user(&msi, argp, sizeof msi)) 2586 if (copy_from_user(&msi, argp, sizeof(msi)))
2587 goto out; 2587 goto out;
2588 r = kvm_send_userspace_msi(kvm, &msi); 2588 r = kvm_send_userspace_msi(kvm, &msi);
2589 break; 2589 break;
@@ -2595,7 +2595,7 @@ static long kvm_vm_ioctl(struct file *filp,
2595 struct kvm_irq_level irq_event; 2595 struct kvm_irq_level irq_event;
2596 2596
2597 r = -EFAULT; 2597 r = -EFAULT;
2598 if (copy_from_user(&irq_event, argp, sizeof irq_event)) 2598 if (copy_from_user(&irq_event, argp, sizeof(irq_event)))
2599 goto out; 2599 goto out;
2600 2600
2601 r = kvm_vm_ioctl_irq_line(kvm, &irq_event, 2601 r = kvm_vm_ioctl_irq_line(kvm, &irq_event,
@@ -2605,7 +2605,7 @@ static long kvm_vm_ioctl(struct file *filp,
2605 2605
2606 r = -EFAULT; 2606 r = -EFAULT;
2607 if (ioctl == KVM_IRQ_LINE_STATUS) { 2607 if (ioctl == KVM_IRQ_LINE_STATUS) {
2608 if (copy_to_user(argp, &irq_event, sizeof irq_event)) 2608 if (copy_to_user(argp, &irq_event, sizeof(irq_event)))
2609 goto out; 2609 goto out;
2610 } 2610 }
2611 2611