mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jesper Juhl <jesper.juhl@gmail.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, Jesper Juhl <jesper.juhl@gmail.com>
Subject: Re: [PATCH] binfmt_elf CodingStyle cleanup and remove some pointless casts
Date: Mon, 24 Apr 2006 23:51:14 +0200	[thread overview]
Message-ID: <200604242351.14610.jesper.juhl@gmail.com> (raw)
In-Reply-To: <20060424133234.34a29533.akpm@osdl.org>

On Monday 24 April 2006 22:32, Andrew Morton wrote:
> Jesper Juhl <jesper.juhl@gmail.com> wrote:
> >
> > 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.
> 
> On 64 bit platforms, these:
> 
> 	some_pointer = (something *)some_u32;
> 	some_u32 = (u32)pointer;
> 
> will generate compile warnings concerning the differently-sized quantities
> on the lhs and rhs.
> 
> The usual way of suppressing this is
> 
> 	some_pointer = (something *)(unsigned long)some_u32;
> 	some_u32 = (unsigned long)pointer;
> 

I see. Thank you for the info, I had not considered that, but it makes sense.
The patch should look like below, then.


Remove redundant casts from NEW_AUX_ENT() arguments in fs/binfmt_elf.c

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

 fs/binfmt_elf.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 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 23:47:23.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,17 @@ 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);
+			    (elf_addr_t)(unsigned long)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 21:50 UTC|newest]

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

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=200604242351.14610.jesper.juhl@gmail.com \
    --to=jesper.juhl@gmail.com \
    --cc=akpm@osdl.org \
    --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

Powered by JetHome