From: Dan Carpenter <dan.carpenter@oracle.com>
To: linux-sh@vger.kernel.org
Subject: [PATCH] sh: ptrace: remove a bogus check
Date: Thu, 22 Feb 2018 09:13:59 +0000 [thread overview]
Message-ID: <20180222091359.GB9883@mwanda> (raw)
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)) {
reply other threads:[~2018-02-22 9:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20180222091359.GB9883@mwanda \
--to=dan.carpenter@oracle.com \
--cc=linux-sh@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;
as well as URLs for NNTP newsgroup(s).