linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sh: ptrace: remove a bogus check
@ 2018-02-22  9:13 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2018-02-22  9:13 UTC (permalink / raw)
  To: linux-sh

We made "addr" unsigned back in 2010 in commit 9b05a69e0534 ("ptrace:
change signature of arch_ptrace()").  The check for negatives was always
just a basic sanity check that duplicated other stricter checks, but now
it causes static checker warnings so we should remove it.

Here is the Smatch warning for reference:

    arch/sh/kernel/ptrace_64.c:399 arch_ptrace()
    warn: unsigned 'addr' is never less than zero.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/arch/sh/kernel/ptrace_64.c b/arch/sh/kernel/ptrace_64.c
index 1e0656d9e7af..b38d53be168a 100644
--- a/arch/sh/kernel/ptrace_64.c
+++ b/arch/sh/kernel/ptrace_64.c
@@ -396,7 +396,7 @@ long arch_ptrace(struct task_struct *child, long request,
 		unsigned long tmp;
 
 		ret = -EIO;
-		if ((addr & 3) || addr < 0)
+		if (addr & 3)
 			break;
 
 		if (addr < sizeof(struct pt_regs))
@@ -424,7 +424,7 @@ long arch_ptrace(struct task_struct *child, long request,
                    this could crash the kernel or result in a security
                    loophole. */
 		ret = -EIO;
-		if ((addr & 3) || addr < 0)
+		if (addr & 3)
 			break;
 
 		if (addr < sizeof(struct pt_regs)) {

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

only message in thread, other threads:[~2018-02-22  9:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-22  9:13 [PATCH] sh: ptrace: remove a bogus check Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).