Re: [PATCH] binfmt_elf CodingStyle cleanup and remove somepointless casts

From: Andrew Morton
Date: Sun Apr 23 2006 - 17:28:16 EST


Jesper Juhl <jesper.juhl@xxxxxxxxx> wrote:
>
> Here's a patch that does a CodingStyle cleanup of fs/binfmt_elf.c and also
> removes some pointless casts of kmalloc() return values in the same file.
>

Much-needed.

> - NEW_AUX_ENT(AT_PHENT, sizeof (struct elf_phdr));
> + NEW_AUX_ENT(AT_PHENT, sizeof(struct elf_phdr));
> NEW_AUX_ENT(AT_PHNUM, exec->e_phnum);
> 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, (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));

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)

-
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/