x86: Clean up 'sizeof x' => 'sizeof(x)'
"sizeof(x)" is the canonical coding style used in arch/x86 most of the time. Fix the few places that didn't follow the convention. (Also do some whitespace cleanups in a few places while at it.) [ mingo: Rewrote the changelog. ] Signed-off-by: Jordan Borgner <mail@jordan-borgner.de> Cc: Borislav Petkov <bp@alien8.de> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/20181028125828.7rgammkgzep2wpam@JordanDesktop Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:

committed by
Ingo Molnar

szülő
4b783dd6a4
commit
0e96f31ea4
@@ -1509,7 +1509,7 @@ static int read_interrupt_descriptor(struct x86_emulate_ctxt *ctxt,
|
||||
return emulate_gp(ctxt, index << 3 | 0x2);
|
||||
|
||||
addr = dt.address + index * 8;
|
||||
return linear_read_system(ctxt, addr, desc, sizeof *desc);
|
||||
return linear_read_system(ctxt, addr, desc, sizeof(*desc));
|
||||
}
|
||||
|
||||
static void get_descriptor_table_ptr(struct x86_emulate_ctxt *ctxt,
|
||||
@@ -1522,7 +1522,7 @@ static void get_descriptor_table_ptr(struct x86_emulate_ctxt *ctxt,
|
||||
struct desc_struct desc;
|
||||
u16 sel;
|
||||
|
||||
memset (dt, 0, sizeof *dt);
|
||||
memset(dt, 0, sizeof(*dt));
|
||||
if (!ops->get_segment(ctxt, &sel, &desc, &base3,
|
||||
VCPU_SREG_LDTR))
|
||||
return;
|
||||
@@ -1586,7 +1586,7 @@ static int write_segment_descriptor(struct x86_emulate_ctxt *ctxt,
|
||||
if (rc != X86EMUL_CONTINUE)
|
||||
return rc;
|
||||
|
||||
return linear_write_system(ctxt, addr, desc, sizeof *desc);
|
||||
return linear_write_system(ctxt, addr, desc, sizeof(*desc));
|
||||
}
|
||||
|
||||
static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt,
|
||||
@@ -1604,7 +1604,7 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt,
|
||||
u16 dummy;
|
||||
u32 base3 = 0;
|
||||
|
||||
memset(&seg_desc, 0, sizeof seg_desc);
|
||||
memset(&seg_desc, 0, sizeof(seg_desc));
|
||||
|
||||
if (ctxt->mode == X86EMUL_MODE_REAL) {
|
||||
/* set real mode segment descriptor (keep limit etc. for
|
||||
@@ -3075,17 +3075,17 @@ static int task_switch_16(struct x86_emulate_ctxt *ctxt,
|
||||
int ret;
|
||||
u32 new_tss_base = get_desc_base(new_desc);
|
||||
|
||||
ret = linear_read_system(ctxt, old_tss_base, &tss_seg, sizeof tss_seg);
|
||||
ret = linear_read_system(ctxt, old_tss_base, &tss_seg, sizeof(tss_seg));
|
||||
if (ret != X86EMUL_CONTINUE)
|
||||
return ret;
|
||||
|
||||
save_state_to_tss16(ctxt, &tss_seg);
|
||||
|
||||
ret = linear_write_system(ctxt, old_tss_base, &tss_seg, sizeof tss_seg);
|
||||
ret = linear_write_system(ctxt, old_tss_base, &tss_seg, sizeof(tss_seg));
|
||||
if (ret != X86EMUL_CONTINUE)
|
||||
return ret;
|
||||
|
||||
ret = linear_read_system(ctxt, new_tss_base, &tss_seg, sizeof tss_seg);
|
||||
ret = linear_read_system(ctxt, new_tss_base, &tss_seg, sizeof(tss_seg));
|
||||
if (ret != X86EMUL_CONTINUE)
|
||||
return ret;
|
||||
|
||||
@@ -3094,7 +3094,7 @@ static int task_switch_16(struct x86_emulate_ctxt *ctxt,
|
||||
|
||||
ret = linear_write_system(ctxt, new_tss_base,
|
||||
&tss_seg.prev_task_link,
|
||||
sizeof tss_seg.prev_task_link);
|
||||
sizeof(tss_seg.prev_task_link));
|
||||
if (ret != X86EMUL_CONTINUE)
|
||||
return ret;
|
||||
}
|
||||
@@ -3216,7 +3216,7 @@ static int task_switch_32(struct x86_emulate_ctxt *ctxt,
|
||||
u32 eip_offset = offsetof(struct tss_segment_32, eip);
|
||||
u32 ldt_sel_offset = offsetof(struct tss_segment_32, ldt_selector);
|
||||
|
||||
ret = linear_read_system(ctxt, old_tss_base, &tss_seg, sizeof tss_seg);
|
||||
ret = linear_read_system(ctxt, old_tss_base, &tss_seg, sizeof(tss_seg));
|
||||
if (ret != X86EMUL_CONTINUE)
|
||||
return ret;
|
||||
|
||||
@@ -3228,7 +3228,7 @@ static int task_switch_32(struct x86_emulate_ctxt *ctxt,
|
||||
if (ret != X86EMUL_CONTINUE)
|
||||
return ret;
|
||||
|
||||
ret = linear_read_system(ctxt, new_tss_base, &tss_seg, sizeof tss_seg);
|
||||
ret = linear_read_system(ctxt, new_tss_base, &tss_seg, sizeof(tss_seg));
|
||||
if (ret != X86EMUL_CONTINUE)
|
||||
return ret;
|
||||
|
||||
@@ -3237,7 +3237,7 @@ static int task_switch_32(struct x86_emulate_ctxt *ctxt,
|
||||
|
||||
ret = linear_write_system(ctxt, new_tss_base,
|
||||
&tss_seg.prev_task_link,
|
||||
sizeof tss_seg.prev_task_link);
|
||||
sizeof(tss_seg.prev_task_link));
|
||||
if (ret != X86EMUL_CONTINUE)
|
||||
return ret;
|
||||
}
|
||||
|
@@ -2409,7 +2409,7 @@ int kvm_apic_set_state(struct kvm_vcpu *vcpu, struct kvm_lapic_state *s)
|
||||
r = kvm_apic_state_fixup(vcpu, s, true);
|
||||
if (r)
|
||||
return r;
|
||||
memcpy(vcpu->arch.apic->regs, s->regs, sizeof *s);
|
||||
memcpy(vcpu->arch.apic->regs, s->regs, sizeof(*s));
|
||||
|
||||
recalculate_apic_map(vcpu->kvm);
|
||||
kvm_apic_set_version(vcpu);
|
||||
|
@@ -2924,7 +2924,7 @@ static int msr_io(struct kvm_vcpu *vcpu, struct kvm_msrs __user *user_msrs,
|
||||
unsigned size;
|
||||
|
||||
r = -EFAULT;
|
||||
if (copy_from_user(&msrs, user_msrs, sizeof msrs))
|
||||
if (copy_from_user(&msrs, user_msrs, sizeof(msrs)))
|
||||
goto out;
|
||||
|
||||
r = -E2BIG;
|
||||
@@ -3091,11 +3091,11 @@ long kvm_arch_dev_ioctl(struct file *filp,
|
||||
unsigned n;
|
||||
|
||||
r = -EFAULT;
|
||||
if (copy_from_user(&msr_list, user_msr_list, sizeof msr_list))
|
||||
if (copy_from_user(&msr_list, user_msr_list, sizeof(msr_list)))
|
||||
goto out;
|
||||
n = msr_list.nmsrs;
|
||||
msr_list.nmsrs = num_msrs_to_save + num_emulated_msrs;
|
||||
if (copy_to_user(user_msr_list, &msr_list, sizeof msr_list))
|
||||
if (copy_to_user(user_msr_list, &msr_list, sizeof(msr_list)))
|
||||
goto out;
|
||||
r = -E2BIG;
|
||||
if (n < msr_list.nmsrs)
|
||||
@@ -3117,7 +3117,7 @@ long kvm_arch_dev_ioctl(struct file *filp,
|
||||
struct kvm_cpuid2 cpuid;
|
||||
|
||||
r = -EFAULT;
|
||||
if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid))
|
||||
if (copy_from_user(&cpuid, cpuid_arg, sizeof(cpuid)))
|
||||
goto out;
|
||||
|
||||
r = kvm_dev_ioctl_get_cpuid(&cpuid, cpuid_arg->entries,
|
||||
@@ -3126,7 +3126,7 @@ long kvm_arch_dev_ioctl(struct file *filp,
|
||||
goto out;
|
||||
|
||||
r = -EFAULT;
|
||||
if (copy_to_user(cpuid_arg, &cpuid, sizeof cpuid))
|
||||
if (copy_to_user(cpuid_arg, &cpuid, sizeof(cpuid)))
|
||||
goto out;
|
||||
r = 0;
|
||||
break;
|
||||
@@ -3894,7 +3894,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
|
||||
struct kvm_interrupt irq;
|
||||
|
||||
r = -EFAULT;
|
||||
if (copy_from_user(&irq, argp, sizeof irq))
|
||||
if (copy_from_user(&irq, argp, sizeof(irq)))
|
||||
goto out;
|
||||
r = kvm_vcpu_ioctl_interrupt(vcpu, &irq);
|
||||
break;
|
||||
@@ -3912,7 +3912,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
|
||||
struct kvm_cpuid cpuid;
|
||||
|
||||
r = -EFAULT;
|
||||
if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid))
|
||||
if (copy_from_user(&cpuid, cpuid_arg, sizeof(cpuid)))
|
||||
goto out;
|
||||
r = kvm_vcpu_ioctl_set_cpuid(vcpu, &cpuid, cpuid_arg->entries);
|
||||
break;
|
||||
@@ -3922,7 +3922,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
|
||||
struct kvm_cpuid2 cpuid;
|
||||
|
||||
r = -EFAULT;
|
||||
if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid))
|
||||
if (copy_from_user(&cpuid, cpuid_arg, sizeof(cpuid)))
|
||||
goto out;
|
||||
r = kvm_vcpu_ioctl_set_cpuid2(vcpu, &cpuid,
|
||||
cpuid_arg->entries);
|
||||
@@ -3933,14 +3933,14 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
|
||||
struct kvm_cpuid2 cpuid;
|
||||
|
||||
r = -EFAULT;
|
||||
if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid))
|
||||
if (copy_from_user(&cpuid, cpuid_arg, sizeof(cpuid)))
|
||||
goto out;
|
||||
r = kvm_vcpu_ioctl_get_cpuid2(vcpu, &cpuid,
|
||||
cpuid_arg->entries);
|
||||
if (r)
|
||||
goto out;
|
||||
r = -EFAULT;
|
||||
if (copy_to_user(cpuid_arg, &cpuid, sizeof cpuid))
|
||||
if (copy_to_user(cpuid_arg, &cpuid, sizeof(cpuid)))
|
||||
goto out;
|
||||
r = 0;
|
||||
break;
|
||||
@@ -3961,13 +3961,13 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
|
||||
struct kvm_tpr_access_ctl tac;
|
||||
|
||||
r = -EFAULT;
|
||||
if (copy_from_user(&tac, argp, sizeof tac))
|
||||
if (copy_from_user(&tac, argp, sizeof(tac)))
|
||||
goto out;
|
||||
r = vcpu_ioctl_tpr_access_reporting(vcpu, &tac);
|
||||
if (r)
|
||||
goto out;
|
||||
r = -EFAULT;
|
||||
if (copy_to_user(argp, &tac, sizeof tac))
|
||||
if (copy_to_user(argp, &tac, sizeof(tac)))
|
||||
goto out;
|
||||
r = 0;
|
||||
break;
|
||||
@@ -3980,7 +3980,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
|
||||
if (!lapic_in_kernel(vcpu))
|
||||
goto out;
|
||||
r = -EFAULT;
|
||||
if (copy_from_user(&va, argp, sizeof va))
|
||||
if (copy_from_user(&va, argp, sizeof(va)))
|
||||
goto out;
|
||||
idx = srcu_read_lock(&vcpu->kvm->srcu);
|
||||
r = kvm_lapic_set_vapic_addr(vcpu, va.vapic_addr);
|
||||
@@ -3991,7 +3991,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
|
||||
u64 mcg_cap;
|
||||
|
||||
r = -EFAULT;
|
||||
if (copy_from_user(&mcg_cap, argp, sizeof mcg_cap))
|
||||
if (copy_from_user(&mcg_cap, argp, sizeof(mcg_cap)))
|
||||
goto out;
|
||||
r = kvm_vcpu_ioctl_x86_setup_mce(vcpu, mcg_cap);
|
||||
break;
|
||||
@@ -4000,7 +4000,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
|
||||
struct kvm_x86_mce mce;
|
||||
|
||||
r = -EFAULT;
|
||||
if (copy_from_user(&mce, argp, sizeof mce))
|
||||
if (copy_from_user(&mce, argp, sizeof(mce)))
|
||||
goto out;
|
||||
r = kvm_vcpu_ioctl_x86_set_mce(vcpu, &mce);
|
||||
break;
|
||||
@@ -4536,7 +4536,7 @@ long kvm_arch_vm_ioctl(struct file *filp,
|
||||
if (kvm->created_vcpus)
|
||||
goto set_identity_unlock;
|
||||
r = -EFAULT;
|
||||
if (copy_from_user(&ident_addr, argp, sizeof ident_addr))
|
||||
if (copy_from_user(&ident_addr, argp, sizeof(ident_addr)))
|
||||
goto set_identity_unlock;
|
||||
r = kvm_vm_ioctl_set_identity_map_addr(kvm, ident_addr);
|
||||
set_identity_unlock:
|
||||
@@ -4620,7 +4620,7 @@ set_identity_unlock:
|
||||
if (r)
|
||||
goto get_irqchip_out;
|
||||
r = -EFAULT;
|
||||
if (copy_to_user(argp, chip, sizeof *chip))
|
||||
if (copy_to_user(argp, chip, sizeof(*chip)))
|
||||
goto get_irqchip_out;
|
||||
r = 0;
|
||||
get_irqchip_out:
|
||||
@@ -4666,7 +4666,7 @@ set_identity_unlock:
|
||||
}
|
||||
case KVM_SET_PIT: {
|
||||
r = -EFAULT;
|
||||
if (copy_from_user(&u.ps, argp, sizeof u.ps))
|
||||
if (copy_from_user(&u.ps, argp, sizeof(u.ps)))
|
||||
goto out;
|
||||
r = -ENXIO;
|
||||
if (!kvm->arch.vpit)
|
||||
@@ -8205,7 +8205,7 @@ static void __get_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
|
||||
sregs->efer = vcpu->arch.efer;
|
||||
sregs->apic_base = kvm_get_apic_base(vcpu);
|
||||
|
||||
memset(sregs->interrupt_bitmap, 0, sizeof sregs->interrupt_bitmap);
|
||||
memset(sregs->interrupt_bitmap, 0, sizeof(sregs->interrupt_bitmap));
|
||||
|
||||
if (vcpu->arch.interrupt.injected && !vcpu->arch.interrupt.soft)
|
||||
set_bit(vcpu->arch.interrupt.nr,
|
||||
@@ -8509,7 +8509,7 @@ int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
|
||||
fpu->last_opcode = fxsave->fop;
|
||||
fpu->last_ip = fxsave->rip;
|
||||
fpu->last_dp = fxsave->rdp;
|
||||
memcpy(fpu->xmm, fxsave->xmm_space, sizeof fxsave->xmm_space);
|
||||
memcpy(fpu->xmm, fxsave->xmm_space, sizeof(fxsave->xmm_space));
|
||||
|
||||
vcpu_put(vcpu);
|
||||
return 0;
|
||||
@@ -8530,7 +8530,7 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
|
||||
fxsave->fop = fpu->last_opcode;
|
||||
fxsave->rip = fpu->last_ip;
|
||||
fxsave->rdp = fpu->last_dp;
|
||||
memcpy(fxsave->xmm_space, fpu->xmm, sizeof fxsave->xmm_space);
|
||||
memcpy(fxsave->xmm_space, fpu->xmm, sizeof(fxsave->xmm_space));
|
||||
|
||||
vcpu_put(vcpu);
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user