public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jesper Juhl <jesper.juhl@gmail.com>
To: "Andrew Morton" <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, ericy@cais.com
Subject: Re: [PATCH] binfmt_elf CodingStyle cleanup and remove some pointless casts
Date: Mon, 24 Apr 2006 19:32:49 +0200	[thread overview]
Message-ID: <200604241932.49912.jesper.juhl@gmail.com> (raw)
In-Reply-To: <9a8748490604240015s61b8b897r34a8be65dc9bac22@mail.gmail.com>

On Monday 24 April 2006 09:15, Jesper Juhl wrote:
> On 4/23/06, Andrew Morton <akpm@osdl.org> 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@gmail.com>
---

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



  reply	other threads:[~2006-04-24 17:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-23 16:58 [PATCH] binfmt_elf CodingStyle cleanup and remove some pointless casts Jesper Juhl
2006-04-23 21:26 ` Andrew Morton
2006-04-24  7:15   ` Jesper Juhl
2006-04-24 17:32     ` Jesper Juhl [this message]
2006-04-24 20:32       ` Andrew Morton
2006-04-24 21:51         ` Jesper Juhl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200604241932.49912.jesper.juhl@gmail.com \
    --to=jesper.juhl@gmail.com \
    --cc=akpm@osdl.org \
    --cc=ericy@cais.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox