Re: [PATCH] binfmt_elf CodingStyle cleanup and remove some pointless casts

From: Jesper Juhl
Date: Mon Apr 24 2006 - 13:32:07 EST


On Monday 24 April 2006 09:15, Jesper Juhl wrote:
> On 4/23/06, Andrew Morton <akpm@xxxxxxxx> wrote:
> > The typecasting for NEW_AUX_ENT is random, ugly, irrational and
> > undesirable. It's always u32 or unsigned long. Perhaps as a followup
> > patch you could look at removing the unneeded casts? (hopefully that'll
> > be all of them)
> >
> Sure, I'll take a look at that this evening, hopefully that'll mean a
> follow-up patch in aproximately 12-16hrs.
>
I got rid of all but one cast.

We still need to cast u_platform from pointer to integer or gcc will yell
at us. But, I don't see why we should first cast it to `unsigned long' and
then to elf_addr_t, so I removed the `unsigned long' cast.

Patch applies on top of the previous one.


Signed-off-by: Jesper Juhl <jesper.juhl@xxxxxxxxx>
---

fs/binfmt_elf.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)

--- linux-2.6.17-rc2-git4/fs/binfmt_elf.c.old 2006-04-24 19:21:14.000000000 +0200
+++ linux-2.6.17-rc2-git4/fs/binfmt_elf.c 2006-04-24 19:20:49.000000000 +0200
@@ -177,10 +177,11 @@ create_elf_tables(struct linux_binprm *b
}

/* Create the ELF interpreter info */
- elf_info = (elf_addr_t *) current->mm->saved_auxv;
+ elf_info = (elf_addr_t *)current->mm->saved_auxv;
#define NEW_AUX_ENT(id, val) \
do { \
- elf_info[ei_index++] = id; elf_info[ei_index++] = val; \
+ elf_info[ei_index++] = id; \
+ elf_info[ei_index++] = val; \
} while (0)

#ifdef ARCH_DLINFO
@@ -199,17 +200,16 @@ create_elf_tables(struct linux_binprm *b
NEW_AUX_ENT(AT_BASE, interp_load_addr);
NEW_AUX_ENT(AT_FLAGS, 0);
NEW_AUX_ENT(AT_ENTRY, exec->e_entry);
- NEW_AUX_ENT(AT_UID, (elf_addr_t)tsk->uid);
- NEW_AUX_ENT(AT_EUID, (elf_addr_t)tsk->euid);
- NEW_AUX_ENT(AT_GID, (elf_addr_t)tsk->gid);
- NEW_AUX_ENT(AT_EGID, (elf_addr_t)tsk->egid);
- NEW_AUX_ENT(AT_SECURE, (elf_addr_t)security_bprm_secureexec(bprm));
+ NEW_AUX_ENT(AT_UID, tsk->uid);
+ NEW_AUX_ENT(AT_EUID, tsk->euid);
+ NEW_AUX_ENT(AT_GID, tsk->gid);
+ NEW_AUX_ENT(AT_EGID, tsk->egid);
+ NEW_AUX_ENT(AT_SECURE, security_bprm_secureexec(bprm));
if (k_platform) {
- NEW_AUX_ENT(AT_PLATFORM,
- (elf_addr_t)(unsigned long)u_platform);
+ NEW_AUX_ENT(AT_PLATFORM, (elf_addr_t)u_platform);
}
if (bprm->interp_flags & BINPRM_FLAGS_EXECFD) {
- NEW_AUX_ENT(AT_EXECFD, (elf_addr_t)bprm->interp_data);
+ NEW_AUX_ENT(AT_EXECFD, bprm->interp_data);
}
#undef NEW_AUX_ENT
/* AT_NULL is zero; clear the rest too */


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/