aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-06-06 19:44:01 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2017-08-31 12:29:07 +0200
commit17fc7e93fd0c819d6ffd0a872930b0d2653ca170 (patch)
tree0606590130f93cedd0c2c08031401bb9e37211c2
parent1201d308519f1e915866d7583d5136d03cc1d384 (diff)
i386: use ROUND_UP macro
I used the clang-tidy qemu-round check (with the option OnlyAlignUp) to generate the fix: https://github.com/elmarco/clang-tools-extra Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Acked-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
-rw-r--r--target/i386/arch_dump.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/target/i386/arch_dump.c b/target/i386/arch_dump.c
index fe0aa36932..1d51bb5206 100644
--- a/target/i386/arch_dump.c
+++ b/target/i386/arch_dump.c
@@ -84,9 +84,9 @@ static int x86_64_write_elf64_note(WriteCoreDumpFunction f,
note->n_descsz = cpu_to_le32(descsz);
note->n_type = cpu_to_le32(NT_PRSTATUS);
buf = (char *)note;
- buf += ((sizeof(Elf64_Nhdr) + 3) / 4) * 4;
+ buf += ROUND_UP(sizeof(Elf64_Nhdr), 4);
memcpy(buf, name, name_size);
- buf += ((name_size + 3) / 4) * 4;
+ buf += ROUND_UP(name_size, 4);
memcpy(buf + 32, &id, 4); /* pr_pid */
buf += descsz - sizeof(x86_64_user_regs_struct)-sizeof(target_ulong);
memcpy(buf, &regs, sizeof(x86_64_user_regs_struct));
@@ -163,9 +163,9 @@ static int x86_write_elf64_note(WriteCoreDumpFunction f, CPUX86State *env,
note->n_descsz = cpu_to_le32(descsz);
note->n_type = cpu_to_le32(NT_PRSTATUS);
buf = (char *)note;
- buf += ((sizeof(Elf64_Nhdr) + 3) / 4) * 4;
+ buf += ROUND_UP(sizeof(Elf64_Nhdr), 4);
memcpy(buf, name, name_size);
- buf += ((name_size + 3) / 4) * 4;
+ buf += ROUND_UP(name_size, 4);
memcpy(buf, &prstatus, sizeof(prstatus));
ret = f(note, note_size, opaque);
@@ -218,9 +218,9 @@ int x86_cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cs,
note->n_descsz = cpu_to_le32(descsz);
note->n_type = cpu_to_le32(NT_PRSTATUS);
buf = (char *)note;
- buf += ((sizeof(Elf32_Nhdr) + 3) / 4) * 4;
+ buf += ROUND_UP(sizeof(Elf32_Nhdr), 4);
memcpy(buf, name, name_size);
- buf += ((name_size + 3) / 4) * 4;
+ buf += ROUND_UP(name_size, 4);
memcpy(buf, &prstatus, sizeof(prstatus));
ret = f(note, note_size, opaque);
@@ -353,9 +353,9 @@ static inline int cpu_write_qemu_note(WriteCoreDumpFunction f,
note64->n_type = 0;
}
buf = note;
- buf += ((note_head_size + 3) / 4) * 4;
+ buf += ROUND_UP(note_head_size, 4);
memcpy(buf, name, name_size);
- buf += ((name_size + 3) / 4) * 4;
+ buf += ROUND_UP(name_size, 4);
memcpy(buf, &state, sizeof(state));
ret = f(note, note_size, opaque);