summaryrefslogtreecommitdiff
path: root/kexec/kexec-elf.c
diff options
context:
space:
mode:
authorZhang Yanfei <zhangyanfei@cn.fujitsu.com>2013-03-15 17:46:35 +0800
committerSimon Horman <horms@verge.net.au>2013-03-15 16:51:02 +0100
commit56af4f566a637b8dd78a8d4ea8624e3d27645e6e (patch)
treea8a120370c50ceda5ee1c2ddb4a14c2cc199d1f7 /kexec/kexec-elf.c
parent337d4fcbdc45e61cab28f8ba6da49015cca5c8d0 (diff)
kexec: use _ALIGN* to make the logic clear
By replacing all the explicit align opertion with marco _ALIGN*, the code logic could more clear. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/kexec-elf.c')
-rw-r--r--kexec/kexec-elf.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/kexec/kexec-elf.c b/kexec/kexec-elf.c
index b88aced..3515203 100644
--- a/kexec/kexec-elf.c
+++ b/kexec/kexec-elf.c
@@ -704,8 +704,8 @@ static int build_mem_notes(struct mem_ehdr *ehdr)
ElfNN_Nhdr hdr;
read_nhdr(ehdr, &hdr, note);
note_size = sizeof(hdr);
- note_size += (hdr.n_namesz + 3) & ~3;
- note_size += (hdr.n_descsz + 3) & ~3;
+ note_size += _ALIGN(hdr.n_namesz, 4);
+ note_size += _ALIGN(hdr.n_descsz, 4);
ehdr->e_notenum += 1;
}
/* Now walk and normalize the notes */
@@ -716,9 +716,9 @@ static int build_mem_notes(struct mem_ehdr *ehdr)
read_nhdr(ehdr, &hdr, note);
note_size = sizeof(hdr);
name = note + note_size;
- note_size += (hdr.n_namesz + 3) & ~3;
+ note_size += _ALIGN(hdr.n_namesz, 4);
desc = note + note_size;
- note_size += (hdr.n_descsz + 3) & ~3;
+ note_size += _ALIGN(hdr.n_descsz, 4);
if ((hdr.n_namesz != 0) && (name[hdr.n_namesz -1] != '\0')) {
/* If note name string is not null terminated, just