From patchwork Thu Feb 22 09:13:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10234909 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 03808602DC for ; Thu, 22 Feb 2018 09:19:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E2FB28AB3 for ; Thu, 22 Feb 2018 09:19:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0119728AB6; Thu, 22 Feb 2018 09:19:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F8FE28AB3 for ; Thu, 22 Feb 2018 09:19:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752948AbeBVJTc (ORCPT ); Thu, 22 Feb 2018 04:19:32 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:48872 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752864AbeBVJTb (ORCPT ); Thu, 22 Feb 2018 04:19:31 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1M9GoUn082649; Thu, 22 Feb 2018 09:19:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2017-10-26; bh=MSrlaLbIM6vUc7bF/Fobs647+k3SxW86qxU6vY52OBE=; b=nB6VAeJb1ci3gHryZQfz2YfOPoZ+PsmVVnpoOGai/4HEUSdyKp3Ur3ecwL9na7ePrDLL x18YwLW6P7JxCe/Z5zhzYyLFanRrBShHRMONqhZ7/1wRqZjC0STRE172RlUmFy3N9C8u uE6SVfnz0FXVvsx9VupgLWbbW+AD9FvwKyp4ej/ecRjpRZq51+yjrPF8ovgHro3PjAl/ nC/EABOyLGiebVD+CNWIgzKE4nHQxjXs8kSnnJW1j1zH6N8ynJZNfqssZJ9j8r+RrPVE ID8CW7Uz9o6uLnFeoXZek/X1CK0IctTCUidxWDJRcKfcq8Slqa92jjKkvkBRqfLkUCA8 FQ== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2g9u2r00uc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2018 09:19:10 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w1M9E8uL028363 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 22 Feb 2018 09:14:08 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w1M9E6cf009274; Thu, 22 Feb 2018 09:14:07 GMT Received: from mwanda (/197.254.35.146) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 22 Feb 2018 01:14:06 -0800 Date: Thu, 22 Feb 2018 12:13:59 +0300 From: Dan Carpenter To: Oleg Nesterov Cc: Yoshinori Sato , Rich Felker , Will Drewry , linux-sh@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] sh: ptrace: remove a bogus check Message-ID: <20180222091359.GB9883@mwanda> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.9.3 (2018-01-21) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8811 signatures=668676 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=634 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802220119 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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)) {