Commit 0e96f31e authored by Jordan Borgner's avatar Jordan Borgner Committed by Ingo Molnar

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: default avatarJordan 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@JordanDesktopSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 4b783dd6
...@@ -113,7 +113,7 @@ int check_cpu(int *cpu_level_ptr, int *req_level_ptr, u32 **err_flags_ptr) ...@@ -113,7 +113,7 @@ int check_cpu(int *cpu_level_ptr, int *req_level_ptr, u32 **err_flags_ptr)
{ {
int err; int err;
memset(&cpu.flags, 0, sizeof cpu.flags); memset(&cpu.flags, 0, sizeof(cpu.flags));
cpu.level = 3; cpu.level = 3;
if (has_eflag(X86_EFLAGS_AC)) if (has_eflag(X86_EFLAGS_AC))
......
...@@ -50,7 +50,7 @@ static void parse_earlyprintk(void) ...@@ -50,7 +50,7 @@ static void parse_earlyprintk(void)
int pos = 0; int pos = 0;
int port = 0; int port = 0;
if (cmdline_find_option("earlyprintk", arg, sizeof arg) > 0) { if (cmdline_find_option("earlyprintk", arg, sizeof(arg)) > 0) {
char *e; char *e;
if (!strncmp(arg, "serial", 6)) { if (!strncmp(arg, "serial", 6)) {
...@@ -124,7 +124,7 @@ static void parse_console_uart8250(void) ...@@ -124,7 +124,7 @@ static void parse_console_uart8250(void)
* console=uart8250,io,0x3f8,115200n8 * console=uart8250,io,0x3f8,115200n8
* need to make sure it is last one console ! * need to make sure it is last one console !
*/ */
if (cmdline_find_option("console", optstr, sizeof optstr) <= 0) if (cmdline_find_option("console", optstr, sizeof(optstr)) <= 0)
return; return;
options = optstr; options = optstr;
......
...@@ -76,7 +76,7 @@ static int get_edd_info(u8 devno, struct edd_info *ei) ...@@ -76,7 +76,7 @@ static int get_edd_info(u8 devno, struct edd_info *ei)
{ {
struct biosregs ireg, oreg; struct biosregs ireg, oreg;
memset(ei, 0, sizeof *ei); memset(ei, 0, sizeof(*ei));
/* Check Extensions Present */ /* Check Extensions Present */
...@@ -133,7 +133,7 @@ void query_edd(void) ...@@ -133,7 +133,7 @@ void query_edd(void)
struct edd_info ei, *edp; struct edd_info ei, *edp;
u32 *mbrptr; u32 *mbrptr;
if (cmdline_find_option("edd", eddarg, sizeof eddarg) > 0) { if (cmdline_find_option("edd", eddarg, sizeof(eddarg)) > 0) {
if (!strcmp(eddarg, "skipmbr") || !strcmp(eddarg, "skip")) { if (!strcmp(eddarg, "skipmbr") || !strcmp(eddarg, "skip")) {
do_edd = 1; do_edd = 1;
do_mbr = 0; do_mbr = 0;
...@@ -166,7 +166,7 @@ void query_edd(void) ...@@ -166,7 +166,7 @@ void query_edd(void)
*/ */
if (!get_edd_info(devno, &ei) if (!get_edd_info(devno, &ei)
&& boot_params.eddbuf_entries < EDDMAXNR) { && boot_params.eddbuf_entries < EDDMAXNR) {
memcpy(edp, &ei, sizeof ei); memcpy(edp, &ei, sizeof(ei));
edp++; edp++;
boot_params.eddbuf_entries++; boot_params.eddbuf_entries++;
} }
......
...@@ -36,8 +36,8 @@ static void copy_boot_params(void) ...@@ -36,8 +36,8 @@ static void copy_boot_params(void)
const struct old_cmdline * const oldcmd = const struct old_cmdline * const oldcmd =
(const struct old_cmdline *)OLD_CL_ADDRESS; (const struct old_cmdline *)OLD_CL_ADDRESS;
BUILD_BUG_ON(sizeof boot_params != 4096); BUILD_BUG_ON(sizeof(boot_params) != 4096);
memcpy(&boot_params.hdr, &hdr, sizeof hdr); memcpy(&boot_params.hdr, &hdr, sizeof(hdr));
if (!boot_params.hdr.cmd_line_ptr && if (!boot_params.hdr.cmd_line_ptr &&
oldcmd->cl_magic == OLD_CL_MAGIC) { oldcmd->cl_magic == OLD_CL_MAGIC) {
......
...@@ -26,7 +26,7 @@ static int detect_memory_e820(void) ...@@ -26,7 +26,7 @@ static int detect_memory_e820(void)
initregs(&ireg); initregs(&ireg);
ireg.ax = 0xe820; ireg.ax = 0xe820;
ireg.cx = sizeof buf; ireg.cx = sizeof(buf);
ireg.edx = SMAP; ireg.edx = SMAP;
ireg.di = (size_t)&buf; ireg.di = (size_t)&buf;
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
void initregs(struct biosregs *reg) void initregs(struct biosregs *reg)
{ {
memset(reg, 0, sizeof *reg); memset(reg, 0, sizeof(*reg));
reg->eflags |= X86_EFLAGS_CF; reg->eflags |= X86_EFLAGS_CF;
reg->ds = ds(); reg->ds = ds();
reg->es = ds(); reg->es = ds();
......
...@@ -62,7 +62,7 @@ static int vesa_probe(void) ...@@ -62,7 +62,7 @@ static int vesa_probe(void)
if (mode & ~0x1ff) if (mode & ~0x1ff)
continue; continue;
memset(&vminfo, 0, sizeof vminfo); /* Just in case... */ memset(&vminfo, 0, sizeof(vminfo)); /* Just in case... */
ireg.ax = 0x4f01; ireg.ax = 0x4f01;
ireg.cx = mode; ireg.cx = mode;
...@@ -109,7 +109,7 @@ static int vesa_set_mode(struct mode_info *mode) ...@@ -109,7 +109,7 @@ static int vesa_set_mode(struct mode_info *mode)
int is_graphic; int is_graphic;
u16 vesa_mode = mode->mode - VIDEO_FIRST_VESA; u16 vesa_mode = mode->mode - VIDEO_FIRST_VESA;
memset(&vminfo, 0, sizeof vminfo); /* Just in case... */ memset(&vminfo, 0, sizeof(vminfo)); /* Just in case... */
initregs(&ireg); initregs(&ireg);
ireg.ax = 0x4f01; ireg.ax = 0x4f01;
...@@ -241,7 +241,7 @@ void vesa_store_edid(void) ...@@ -241,7 +241,7 @@ void vesa_store_edid(void)
struct biosregs ireg, oreg; struct biosregs ireg, oreg;
/* Apparently used as a nonsense token... */ /* Apparently used as a nonsense token... */
memset(&boot_params.edid_info, 0x13, sizeof boot_params.edid_info); memset(&boot_params.edid_info, 0x13, sizeof(boot_params.edid_info));
if (vginfo.version < 0x0200) if (vginfo.version < 0x0200)
return; /* EDID requires VBE 2.0+ */ return; /* EDID requires VBE 2.0+ */
......
...@@ -115,7 +115,7 @@ static unsigned int get_entry(void) ...@@ -115,7 +115,7 @@ static unsigned int get_entry(void)
} else if ((key >= '0' && key <= '9') || } else if ((key >= '0' && key <= '9') ||
(key >= 'A' && key <= 'Z') || (key >= 'A' && key <= 'Z') ||
(key >= 'a' && key <= 'z')) { (key >= 'a' && key <= 'z')) {
if (len < sizeof entry_buf) { if (len < sizeof(entry_buf)) {
entry_buf[len++] = key; entry_buf[len++] = key;
putchar(key); putchar(key);
} }
......
...@@ -4535,7 +4535,7 @@ __init int intel_pmu_init(void) ...@@ -4535,7 +4535,7 @@ __init int intel_pmu_init(void)
} }
} }
snprintf(pmu_name_str, sizeof pmu_name_str, "%s", name); snprintf(pmu_name_str, sizeof(pmu_name_str), "%s", name);
if (version >= 2 && extra_attr) { if (version >= 2 && extra_attr) {
x86_pmu.format_attrs = merge_attr(intel_arch3_formats_attr, x86_pmu.format_attrs = merge_attr(intel_arch3_formats_attr,
......
...@@ -1074,7 +1074,7 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c) ...@@ -1074,7 +1074,7 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
#endif #endif
c->x86_cache_alignment = c->x86_clflush_size; c->x86_cache_alignment = c->x86_clflush_size;
memset(&c->x86_capability, 0, sizeof c->x86_capability); memset(&c->x86_capability, 0, sizeof(c->x86_capability));
c->extended_cpuid_level = 0; c->extended_cpuid_level = 0;
if (!have_cpuid_p()) if (!have_cpuid_p())
...@@ -1317,7 +1317,7 @@ static void identify_cpu(struct cpuinfo_x86 *c) ...@@ -1317,7 +1317,7 @@ static void identify_cpu(struct cpuinfo_x86 *c)
c->x86_virt_bits = 32; c->x86_virt_bits = 32;
#endif #endif
c->x86_cache_alignment = c->x86_clflush_size; c->x86_cache_alignment = c->x86_clflush_size;
memset(&c->x86_capability, 0, sizeof c->x86_capability); memset(&c->x86_capability, 0, sizeof(c->x86_capability));
generic_identify(c); generic_identify(c);
......
...@@ -2215,7 +2215,7 @@ static int mce_device_create(unsigned int cpu) ...@@ -2215,7 +2215,7 @@ static int mce_device_create(unsigned int cpu)
if (dev) if (dev)
return 0; return 0;
dev = kzalloc(sizeof *dev, GFP_KERNEL); dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (!dev) if (!dev)
return -ENOMEM; return -ENOMEM;
dev->id = cpu; dev->id = cpu;
......
...@@ -798,7 +798,7 @@ static void generic_set_all(void) ...@@ -798,7 +798,7 @@ static void generic_set_all(void)
local_irq_restore(flags); local_irq_restore(flags);
/* Use the atomic bitops to update the global mask */ /* Use the atomic bitops to update the global mask */
for (count = 0; count < sizeof mask * 8; ++count) { for (count = 0; count < sizeof(mask) * 8; ++count) {
if (mask & 0x01) if (mask & 0x01)
set_bit(count, &smp_changes_mask); set_bit(count, &smp_changes_mask);
mask >>= 1; mask >>= 1;
......
...@@ -174,12 +174,12 @@ mtrr_ioctl(struct file *file, unsigned int cmd, unsigned long __arg) ...@@ -174,12 +174,12 @@ mtrr_ioctl(struct file *file, unsigned int cmd, unsigned long __arg)
case MTRRIOC_SET_PAGE_ENTRY: case MTRRIOC_SET_PAGE_ENTRY:
case MTRRIOC_DEL_PAGE_ENTRY: case MTRRIOC_DEL_PAGE_ENTRY:
case MTRRIOC_KILL_PAGE_ENTRY: case MTRRIOC_KILL_PAGE_ENTRY:
if (copy_from_user(&sentry, arg, sizeof sentry)) if (copy_from_user(&sentry, arg, sizeof(sentry)))
return -EFAULT; return -EFAULT;
break; break;
case MTRRIOC_GET_ENTRY: case MTRRIOC_GET_ENTRY:
case MTRRIOC_GET_PAGE_ENTRY: case MTRRIOC_GET_PAGE_ENTRY:
if (copy_from_user(&gentry, arg, sizeof gentry)) if (copy_from_user(&gentry, arg, sizeof(gentry)))
return -EFAULT; return -EFAULT;
break; break;
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
...@@ -332,7 +332,7 @@ mtrr_ioctl(struct file *file, unsigned int cmd, unsigned long __arg) ...@@ -332,7 +332,7 @@ mtrr_ioctl(struct file *file, unsigned int cmd, unsigned long __arg)
switch (cmd) { switch (cmd) {
case MTRRIOC_GET_ENTRY: case MTRRIOC_GET_ENTRY:
case MTRRIOC_GET_PAGE_ENTRY: case MTRRIOC_GET_PAGE_ENTRY:
if (copy_to_user(arg, &gentry, sizeof gentry)) if (copy_to_user(arg, &gentry, sizeof(gentry)))
err = -EFAULT; err = -EFAULT;
break; break;
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
......
...@@ -385,7 +385,7 @@ static void __init copy_bootdata(char *real_mode_data) ...@@ -385,7 +385,7 @@ static void __init copy_bootdata(char *real_mode_data)
*/ */
sme_map_bootdata(real_mode_data); sme_map_bootdata(real_mode_data);
memcpy(&boot_params, real_mode_data, sizeof boot_params); memcpy(&boot_params, real_mode_data, sizeof(boot_params));
sanitize_boot_params(&boot_params); sanitize_boot_params(&boot_params);
cmd_line_ptr = get_cmd_line_ptr(); cmd_line_ptr = get_cmd_line_ptr();
if (cmd_line_ptr) { if (cmd_line_ptr) {
......
...@@ -115,14 +115,14 @@ static long msr_ioctl(struct file *file, unsigned int ioc, unsigned long arg) ...@@ -115,14 +115,14 @@ static long msr_ioctl(struct file *file, unsigned int ioc, unsigned long arg)
err = -EBADF; err = -EBADF;
break; break;
} }
if (copy_from_user(&regs, uregs, sizeof regs)) { if (copy_from_user(&regs, uregs, sizeof(regs))) {
err = -EFAULT; err = -EFAULT;
break; break;
} }
err = rdmsr_safe_regs_on_cpu(cpu, regs); err = rdmsr_safe_regs_on_cpu(cpu, regs);
if (err) if (err)
break; break;
if (copy_to_user(uregs, &regs, sizeof regs)) if (copy_to_user(uregs, &regs, sizeof(regs)))
err = -EFAULT; err = -EFAULT;
break; break;
...@@ -131,14 +131,14 @@ static long msr_ioctl(struct file *file, unsigned int ioc, unsigned long arg) ...@@ -131,14 +131,14 @@ static long msr_ioctl(struct file *file, unsigned int ioc, unsigned long arg)
err = -EBADF; err = -EBADF;
break; break;
} }
if (copy_from_user(&regs, uregs, sizeof regs)) { if (copy_from_user(&regs, uregs, sizeof(regs))) {
err = -EFAULT; err = -EFAULT;
break; break;
} }
err = wrmsr_safe_regs_on_cpu(cpu, regs); err = wrmsr_safe_regs_on_cpu(cpu, regs);
if (err) if (err)
break; break;
if (copy_to_user(uregs, &regs, sizeof regs)) if (copy_to_user(uregs, &regs, sizeof(regs)))
err = -EFAULT; err = -EFAULT;
break; break;
......
...@@ -1509,7 +1509,7 @@ static int read_interrupt_descriptor(struct x86_emulate_ctxt *ctxt, ...@@ -1509,7 +1509,7 @@ static int read_interrupt_descriptor(struct x86_emulate_ctxt *ctxt,
return emulate_gp(ctxt, index << 3 | 0x2); return emulate_gp(ctxt, index << 3 | 0x2);
addr = dt.address + index * 8; 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, 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, ...@@ -1522,7 +1522,7 @@ static void get_descriptor_table_ptr(struct x86_emulate_ctxt *ctxt,
struct desc_struct desc; struct desc_struct desc;
u16 sel; u16 sel;
memset (dt, 0, sizeof *dt); memset(dt, 0, sizeof(*dt));
if (!ops->get_segment(ctxt, &sel, &desc, &base3, if (!ops->get_segment(ctxt, &sel, &desc, &base3,
VCPU_SREG_LDTR)) VCPU_SREG_LDTR))
return; return;
...@@ -1586,7 +1586,7 @@ static int write_segment_descriptor(struct x86_emulate_ctxt *ctxt, ...@@ -1586,7 +1586,7 @@ static int write_segment_descriptor(struct x86_emulate_ctxt *ctxt,
if (rc != X86EMUL_CONTINUE) if (rc != X86EMUL_CONTINUE)
return rc; 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, static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt,
...@@ -1604,7 +1604,7 @@ 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; u16 dummy;
u32 base3 = 0; u32 base3 = 0;
memset(&seg_desc, 0, sizeof seg_desc); memset(&seg_desc, 0, sizeof(seg_desc));
if (ctxt->mode == X86EMUL_MODE_REAL) { if (ctxt->mode == X86EMUL_MODE_REAL) {
/* set real mode segment descriptor (keep limit etc. for /* set real mode segment descriptor (keep limit etc. for
...@@ -3075,17 +3075,17 @@ static int task_switch_16(struct x86_emulate_ctxt *ctxt, ...@@ -3075,17 +3075,17 @@ static int task_switch_16(struct x86_emulate_ctxt *ctxt,
int ret; int ret;
u32 new_tss_base = get_desc_base(new_desc); 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) if (ret != X86EMUL_CONTINUE)
return ret; return ret;
save_state_to_tss16(ctxt, &tss_seg); 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) if (ret != X86EMUL_CONTINUE)
return ret; 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) if (ret != X86EMUL_CONTINUE)
return ret; return ret;
...@@ -3094,7 +3094,7 @@ static int task_switch_16(struct x86_emulate_ctxt *ctxt, ...@@ -3094,7 +3094,7 @@ static int task_switch_16(struct x86_emulate_ctxt *ctxt,
ret = linear_write_system(ctxt, new_tss_base, ret = linear_write_system(ctxt, new_tss_base,
&tss_seg.prev_task_link, &tss_seg.prev_task_link,
sizeof tss_seg.prev_task_link); sizeof(tss_seg.prev_task_link));
if (ret != X86EMUL_CONTINUE) if (ret != X86EMUL_CONTINUE)
return ret; return ret;
} }
...@@ -3216,7 +3216,7 @@ static int task_switch_32(struct x86_emulate_ctxt *ctxt, ...@@ -3216,7 +3216,7 @@ static int task_switch_32(struct x86_emulate_ctxt *ctxt,
u32 eip_offset = offsetof(struct tss_segment_32, eip); u32 eip_offset = offsetof(struct tss_segment_32, eip);
u32 ldt_sel_offset = offsetof(struct tss_segment_32, ldt_selector); 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) if (ret != X86EMUL_CONTINUE)
return ret; return ret;
...@@ -3228,7 +3228,7 @@ static int task_switch_32(struct x86_emulate_ctxt *ctxt, ...@@ -3228,7 +3228,7 @@ static int task_switch_32(struct x86_emulate_ctxt *ctxt,
if (ret != X86EMUL_CONTINUE) if (ret != X86EMUL_CONTINUE)
return ret; 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) if (ret != X86EMUL_CONTINUE)
return ret; return ret;
...@@ -3237,7 +3237,7 @@ static int task_switch_32(struct x86_emulate_ctxt *ctxt, ...@@ -3237,7 +3237,7 @@ static int task_switch_32(struct x86_emulate_ctxt *ctxt,
ret = linear_write_system(ctxt, new_tss_base, ret = linear_write_system(ctxt, new_tss_base,
&tss_seg.prev_task_link, &tss_seg.prev_task_link,
sizeof tss_seg.prev_task_link); sizeof(tss_seg.prev_task_link));
if (ret != X86EMUL_CONTINUE) if (ret != X86EMUL_CONTINUE)
return ret; return ret;
} }
......
...@@ -2409,7 +2409,7 @@ int kvm_apic_set_state(struct kvm_vcpu *vcpu, struct kvm_lapic_state *s) ...@@ -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); r = kvm_apic_state_fixup(vcpu, s, true);
if (r) if (r)
return 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); recalculate_apic_map(vcpu->kvm);
kvm_apic_set_version(vcpu); kvm_apic_set_version(vcpu);
......
...@@ -2924,7 +2924,7 @@ static int msr_io(struct kvm_vcpu *vcpu, struct kvm_msrs __user *user_msrs, ...@@ -2924,7 +2924,7 @@ static int msr_io(struct kvm_vcpu *vcpu, struct kvm_msrs __user *user_msrs,
unsigned size; unsigned size;
r = -EFAULT; r = -EFAULT;
if (copy_from_user(&msrs, user_msrs, sizeof msrs)) if (copy_from_user(&msrs, user_msrs, sizeof(msrs)))
goto out; goto out;
r = -E2BIG; r = -E2BIG;
...@@ -3091,11 +3091,11 @@ long kvm_arch_dev_ioctl(struct file *filp, ...@@ -3091,11 +3091,11 @@ long kvm_arch_dev_ioctl(struct file *filp,
unsigned n; unsigned n;
r = -EFAULT; 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; goto out;
n = msr_list.nmsrs; n = msr_list.nmsrs;
msr_list.nmsrs = num_msrs_to_save + num_emulated_msrs; 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; goto out;
r = -E2BIG; r = -E2BIG;
if (n < msr_list.nmsrs) if (n < msr_list.nmsrs)
...@@ -3117,7 +3117,7 @@ long kvm_arch_dev_ioctl(struct file *filp, ...@@ -3117,7 +3117,7 @@ long kvm_arch_dev_ioctl(struct file *filp,
struct kvm_cpuid2 cpuid; struct kvm_cpuid2 cpuid;
r = -EFAULT; r = -EFAULT;
if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid)) if (copy_from_user(&cpuid, cpuid_arg, sizeof(cpuid)))
goto out; goto out;
r = kvm_dev_ioctl_get_cpuid(&cpuid, cpuid_arg->entries, r = kvm_dev_ioctl_get_cpuid(&cpuid, cpuid_arg->entries,
...@@ -3126,7 +3126,7 @@ long kvm_arch_dev_ioctl(struct file *filp, ...@@ -3126,7 +3126,7 @@ long kvm_arch_dev_ioctl(struct file *filp,
goto out; goto out;
r = -EFAULT; r = -EFAULT;
if (copy_to_user(cpuid_arg, &cpuid, sizeof cpuid)) if (copy_to_user(cpuid_arg, &cpuid, sizeof(cpuid)))
goto out; goto out;
r = 0; r = 0;
break; break;
...@@ -3894,7 +3894,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp, ...@@ -3894,7 +3894,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
struct kvm_interrupt irq; struct kvm_interrupt irq;
r = -EFAULT; r = -EFAULT;
if (copy_from_user(&irq, argp, sizeof irq)) if (copy_from_user(&irq, argp, sizeof(irq)))
goto out; goto out;
r = kvm_vcpu_ioctl_interrupt(vcpu, &irq); r = kvm_vcpu_ioctl_interrupt(vcpu, &irq);
break; break;
...@@ -3912,7 +3912,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp, ...@@ -3912,7 +3912,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
struct kvm_cpuid cpuid; struct kvm_cpuid cpuid;
r = -EFAULT; r = -EFAULT;
if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid)) if (copy_from_user(&cpuid, cpuid_arg, sizeof(cpuid)))
goto out; goto out;
r = kvm_vcpu_ioctl_set_cpuid(vcpu, &cpuid, cpuid_arg->entries); r = kvm_vcpu_ioctl_set_cpuid(vcpu, &cpuid, cpuid_arg->entries);
break; break;
...@@ -3922,7 +3922,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp, ...@@ -3922,7 +3922,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
struct kvm_cpuid2 cpuid; struct kvm_cpuid2 cpuid;
r = -EFAULT; r = -EFAULT;
if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid)) if (copy_from_user(&cpuid, cpuid_arg, sizeof(cpuid)))
goto out; goto out;
r = kvm_vcpu_ioctl_set_cpuid2(vcpu, &cpuid, r = kvm_vcpu_ioctl_set_cpuid2(vcpu, &cpuid,
cpuid_arg->entries); cpuid_arg->entries);
...@@ -3933,14 +3933,14 @@ long kvm_arch_vcpu_ioctl(struct file *filp, ...@@ -3933,14 +3933,14 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
struct kvm_cpuid2 cpuid; struct kvm_cpuid2 cpuid;
r = -EFAULT; r = -EFAULT;
if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid)) if (copy_from_user(&cpuid, cpuid_arg, sizeof(cpuid)))
goto out; goto out;
r = kvm_vcpu_ioctl_get_cpuid2(vcpu, &cpuid, r = kvm_vcpu_ioctl_get_cpuid2(vcpu, &cpuid,
cpuid_arg->entries); cpuid_arg->entries);
if (r) if (r)
goto out; goto out;
r = -EFAULT; r = -EFAULT;
if (copy_to_user(cpuid_arg, &cpuid, sizeof cpuid)) if (copy_to_user(cpuid_arg, &cpuid, sizeof(cpuid)))
goto out; goto out;
r = 0; r = 0;
break; break;
...@@ -3961,13 +3961,13 @@ long kvm_arch_vcpu_ioctl(struct file *filp, ...@@ -3961,13 +3961,13 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
struct kvm_tpr_access_ctl tac; struct kvm_tpr_access_ctl tac;
r = -EFAULT; r = -EFAULT;
if (copy_from_user(&tac, argp, sizeof tac)) if (copy_from_user(&tac, argp, sizeof(tac)))
goto out; goto out;
r = vcpu_ioctl_tpr_access_reporting(vcpu, &tac); r = vcpu_ioctl_tpr_access_reporting(vcpu, &tac);
if (r) if (r)
goto out; goto out;
r = -EFAULT; r = -EFAULT;
if (copy_to_user(argp, &tac, sizeof tac)) if (copy_to_user(argp, &tac, sizeof(tac)))
goto out; goto out;
r = 0; r = 0;
break; break;
...@@ -3980,7 +3980,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp, ...@@ -3980,7 +3980,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
if (!lapic_in_kernel(vcpu)) if (!lapic_in_kernel(vcpu))
goto out; goto out;
r = -EFAULT; r = -EFAULT;
if (copy_from_user(&va, argp, sizeof va)) if (copy_from_user(&va, argp, sizeof(va)))
goto out; goto out;
idx = srcu_read_lock(&vcpu->kvm->srcu); idx = srcu_read_lock(&vcpu->kvm->srcu);
r = kvm_lapic_set_vapic_addr(vcpu, va.vapic_addr); r = kvm_lapic_set_vapic_addr(vcpu, va.vapic_addr);
...@@ -3991,7 +3991,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp, ...@@ -3991,7 +3991,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
u64 mcg_cap; u64 mcg_cap;
r = -EFAULT; r = -EFAULT;
if (copy_from_user(&mcg_cap, argp, sizeof mcg_cap)) if (copy_from_user(&mcg_cap, argp, sizeof(mcg_cap)))
goto out; goto out;
r = kvm_vcpu_ioctl_x86_setup_mce(vcpu, mcg_cap); r = kvm_vcpu_ioctl_x86_setup_mce(vcpu, mcg_cap);
break; break;
...@@ -4000,7 +4000,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp, ...@@ -4000,7 +4000,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
struct kvm_x86_mce mce; struct kvm_x86_mce mce;
r = -EFAULT; r = -EFAULT;
if (copy_from_user(&mce, argp, sizeof mce)) if (copy_from_user(&mce, argp, sizeof(mce)))
goto out; goto out;
r = kvm_vcpu_ioctl_x86_set_mce(vcpu, &mce); r = kvm_vcpu_ioctl_x86_set_mce(vcpu, &mce);
break; break;
...@@ -4536,7 +4536,7 @@ long kvm_arch_vm_ioctl(struct file *filp, ...@@ -4536,7 +4536,7 @@ long kvm_arch_vm_ioctl(struct file *filp,
if (kvm->created_vcpus) if (kvm->created_vcpus)
goto set_identity_unlock; goto set_identity_unlock;
r = -EFAULT; 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; goto set_identity_unlock;
r = kvm_vm_ioctl_set_identity_map_addr(kvm, ident_addr); r = kvm_vm_ioctl_set_identity_map_addr(kvm, ident_addr);
set_identity_unlock: set_identity_unlock:
...@@ -4620,7 +4620,7 @@ long kvm_arch_vm_ioctl(struct file *filp, ...@@ -4620,7 +4620,7 @@ long kvm_arch_vm_ioctl(struct file *filp,
if (r) if (r)
goto get_irqchip_out; goto get_irqchip_out;
r = -EFAULT; r = -EFAULT;
if (copy_to_user(argp, chip, sizeof *chip)) if (copy_to_user(argp, chip, sizeof(*chip)))
goto get_irqchip_out; goto get_irqchip_out;
r = 0; r = 0;
get_irqchip_out: get_irqchip_out:
...@@ -4666,7 +4666,7 @@ long kvm_arch_vm_ioctl(struct file *filp, ...@@ -4666,7 +4666,7 @@ long kvm_arch_vm_ioctl(struct file *filp,
} }
case KVM_SET_PIT: { case KVM_SET_PIT: {
r = -EFAULT; r = -EFAULT;
if (copy_from_user(&u.ps, argp, sizeof u.ps)) if (copy_from_user(&u.ps, argp, sizeof(u.ps)))
goto out; goto out;
r = -ENXIO; r = -ENXIO;
if (!kvm->arch.vpit) if (!kvm->arch.vpit)
...@@ -8205,7 +8205,7 @@ static void __get_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) ...@@ -8205,7 +8205,7 @@ static void __get_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
sregs->efer = vcpu->arch.efer; sregs->efer = vcpu->arch.efer;
sregs->apic_base = kvm_get_apic_base(vcpu); 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) if (vcpu->arch.interrupt.injected && !vcpu->arch.interrupt.soft)
set_bit(vcpu->arch.interrupt.nr, 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) ...@@ -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_opcode = fxsave->fop;
fpu->last_ip = fxsave->rip; fpu->last_ip = fxsave->rip;
fpu->last_dp = fxsave->rdp; 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); vcpu_put(vcpu);
return 0; return 0;
...@@ -8530,7 +8530,7 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) ...@@ -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->fop = fpu->last_opcode;
fxsave->rip = fpu->last_ip; fxsave->rip = fpu->last_ip;
fxsave->rdp = fpu->last_dp; 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); vcpu_put(vcpu);
return 0; return 0;
......
...@@ -130,7 +130,7 @@ static void regex_init(int use_real_mode) ...@@ -130,7 +130,7 @@ static void regex_init(int use_real_mode)
REG_EXTENDED|REG_NOSUB); REG_EXTENDED|REG_NOSUB);
if (err) { if (err) {
regerror(err, &sym_regex_c[i], errbuf, sizeof errbuf); regerror(err, &sym_regex_c[i], errbuf, sizeof(errbuf));
die("%s", errbuf); die("%s", errbuf);
} }
} }
...@@ -405,7 +405,7 @@ static void read_shdrs(FILE *fp) ...@@ -405,7 +405,7 @@ static void read_shdrs(FILE *fp)
} }
for (i = 0; i < ehdr.e_shnum; i++) { for (i = 0; i < ehdr.e_shnum; i++) {
struct section *sec = &secs[i]; struct section *sec = &secs[i];
if (fread(&shdr, sizeof shdr, 1, fp) != 1) if (fread(&shdr, sizeof(shdr), 1, fp) != 1)
die("Cannot read ELF section headers %d/%d: %s\n", die("Cannot read ELF section headers %d/%d: %s\n",
i, ehdr.e_shnum, strerror(errno)); i, ehdr.e_shnum, strerror(errno));
sec->shdr.sh_name = elf_word_to_cpu(shdr.sh_name); sec->shdr.sh_name = elf_word_to_cpu(shdr.sh_name);
......
...@@ -194,7 +194,7 @@ extern unsigned long um_vdso_addr; ...@@ -194,7 +194,7 @@ extern unsigned long um_vdso_addr;
typedef unsigned long elf_greg_t; typedef unsigned long elf_greg_t;
#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t)) #define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
typedef elf_greg_t elf_gregset_t[ELF_NGREG]; typedef elf_greg_t elf_gregset_t[ELF_NGREG];
typedef struct user_i387_struct elf_fpregset_t; typedef struct user_i387_struct elf_fpregset_t;
......
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