public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] remove meaningless <0 comparison in binfmt_elf
@ 2005-06-06 23:20 Jesper Juhl
  0 siblings, 0 replies; only message in thread
From: Jesper Juhl @ 2005-06-06 23:20 UTC (permalink / raw)
  To: Eric Youngdale; +Cc: Andrew Morton, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 1190 bytes --]

'i' is clearly defined at the start of the function to be unsigned, so
comparing it to be less than zero is meaningless.
This patch removes the meaningless comparison.

Since I'm away from home I can't use my usual pine to send the email,
but have to use gmail, and I don't know how gmail will treat the
inline patch, so I'm also attaching it.


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

 fs/binfmt_elf.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6.12-rc6-orig/fs/binfmt_elf.c	2005-06-07 00:07:40.000000000 +0200
+++ linux-2.6.12-rc6/fs/binfmt_elf.c	2005-06-07 01:12:37.000000000 +0200
@@ -1324,7 +1324,7 @@ static int fill_psinfo(struct elf_prpsin
 
 	i = p->state ? ffz(~p->state) + 1 : 0;
 	psinfo->pr_state = i;
-	psinfo->pr_sname = (i < 0 || i > 5) ? '.' : "RSDTZW"[i];
+	psinfo->pr_sname = i > 5 ? '.' : "RSDTZW"[i];
 	psinfo->pr_zomb = psinfo->pr_sname == 'Z';
 	psinfo->pr_nice = task_nice(p);
 	psinfo->pr_flag = p->flags;



-- 
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

[-- Attachment #2: binfmt_elf-unsigned-checked-for-less-than-zero.patch --]
[-- Type: text/x-patch, Size: 497 bytes --]

--- linux-2.6.12-rc6-orig/fs/binfmt_elf.c	2005-06-07 00:07:40.000000000 +0200
+++ linux-2.6.12-rc6/fs/binfmt_elf.c	2005-06-07 01:12:37.000000000 +0200
@@ -1324,7 +1324,7 @@ static int fill_psinfo(struct elf_prpsin
 
 	i = p->state ? ffz(~p->state) + 1 : 0;
 	psinfo->pr_state = i;
-	psinfo->pr_sname = (i < 0 || i > 5) ? '.' : "RSDTZW"[i];
+	psinfo->pr_sname = i > 5 ? '.' : "RSDTZW"[i];
 	psinfo->pr_zomb = psinfo->pr_sname == 'Z';
 	psinfo->pr_nice = task_nice(p);
 	psinfo->pr_flag = p->flags;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-06-06 23:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-06 23:20 [PATCH] remove meaningless <0 comparison in binfmt_elf Jesper Juhl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox