From 22a8cb8248ba5d340307ba72432253b1dbdb5cf7 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Tue, 8 Oct 2013 11:05:01 -0400 Subject: new helper: dump_align() dump_skip to given alignment... Signed-off-by: Al Viro --- fs/binfmt_elf.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'fs/binfmt_elf.c') diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index c56ae3264a65..864154972670 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -1225,12 +1225,6 @@ static int notesize(struct memelfnote *en) return sz; } -static int alignfile(struct coredump_params *cprm) -{ - static const char buf[4] = { 0, }; - return dump_emit(cprm, buf, roundup(cprm->written, 4) - cprm->written); -} - static int writenote(struct memelfnote *men, struct coredump_params *cprm) { struct elf_note en; @@ -1239,8 +1233,8 @@ static int writenote(struct memelfnote *men, struct coredump_params *cprm) en.n_type = men->type; return dump_emit(cprm, &en, sizeof(en)) && - dump_emit(cprm, men->name, en.n_namesz) && alignfile(cprm) && - dump_emit(cprm, men->data, men->datasz) && alignfile(cprm); + dump_emit(cprm, men->name, en.n_namesz) && dump_align(cprm, 4) && + dump_emit(cprm, men->data, men->datasz) && dump_align(cprm, 4); } static void fill_elf_header(struct elfhdr *elf, int segs, -- cgit v1.2.3