From patchwork Fri Oct 23 15:59:21 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: roel kluin X-Patchwork-Id: 36788 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 63E62B7BCC for ; Sat, 24 Oct 2009 02:49:14 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752348AbZJWPtD (ORCPT ); Fri, 23 Oct 2009 11:49:03 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752326AbZJWPtC (ORCPT ); Fri, 23 Oct 2009 11:49:02 -0400 Received: from mail-ew0-f208.google.com ([209.85.219.208]:45618 "EHLO mail-ew0-f208.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752302AbZJWPtB (ORCPT ); Fri, 23 Oct 2009 11:49:01 -0400 Received: by ewy4 with SMTP id 4so1751623ewy.37 for ; Fri, 23 Oct 2009 08:49:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=y9iOAmIbtFndz0mDUkalvFZL6FlxOPdhyAM8FZhWTow=; b=BzMGIEXuD6KazqpoizvXxEBJhlBCQz4OBCo1nT+1e/pgEUNSwrZbSJXr+st5ei+z1n x1MH3CqebN07IEa3BMOrGYI5QTYvKtdbYR1EmtTB333ars+AHLFYsTev/yA0rpoMJiGg L9YIj4yrEXgxrW++jWJwTWlJko8uKV0oX94oI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=fMoOn5STr2YACX35OjQxM70dxebCGf4C3ttEWtcGrFz6eSMEVL0XirfGhSRMbu5Dj2 P2dkB5Sl19wvLu2nwHn8+r+u1mdVxvA0nlxklQoo3OKvAXprqnu98I+YJSn+8SSMdzYu q5D9LpT1YyCxrHKcign3MA4NOuITpsvtIU63U= Received: by 10.210.160.12 with SMTP id i12mr830853ebe.9.1256312945090; Fri, 23 Oct 2009 08:49:05 -0700 (PDT) Received: from zoinx.mars (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id 28sm3250104eyg.6.2009.10.23.08.49.03 (version=SSLv3 cipher=RC4-MD5); Fri, 23 Oct 2009 08:49:04 -0700 (PDT) Message-ID: <4AE1D2D9.5000906@gmail.com> Date: Fri, 23 Oct 2009 17:59:21 +0200 From: Roel Kluin User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Thunderbird/3.0b4 MIME-Version: 1.0 To: "David S. Miller" , netdev@vger.kernel.org, Andrew Morton Subject: [PATCH] net: Cleanup redundant tests on unsigned Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org optlen is unsigned so the `< 0' test is never true. Signed-off-by: Roel Kluin --- net/can/raw.c | 2 -- net/compat.c | 3 --- net/ipv4/ip_sockglue.c | 2 +- 3 files changed, 1 insertions(+), 6 deletions(-) Or should the tests in net/can/raw.c or net/compat.c be replaced by something else? -- To unsubscribe from this list: send the line "unsubscribe netdev" 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/net/can/raw.c b/net/can/raw.c index b5e8979..9e18c2a 100644 --- a/net/can/raw.c +++ b/net/can/raw.c @@ -424,8 +424,6 @@ static int raw_setsockopt(struct socket *sock, int level, int optname, if (level != SOL_CAN_RAW) return -EINVAL; - if (optlen < 0) - return -EINVAL; switch (optname) { diff --git a/net/compat.c b/net/compat.c index a407c3a..e373995 100644 --- a/net/compat.c +++ b/net/compat.c @@ -390,9 +390,6 @@ asmlinkage long compat_sys_setsockopt(int fd, int level, int optname, int err; struct socket *sock; - if (optlen < 0) - return -EINVAL; - if ((sock = sockfd_lookup(fd, &err))!=NULL) { err = security_socket_setsockopt(sock,level,optname); diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index e982b5c..15dbf30 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c @@ -480,7 +480,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, case IP_OPTIONS: { struct ip_options *opt = NULL; - if (optlen > 40 || optlen < 0) + if (optlen > 40) goto e_inval; err = ip_options_get_from_user(sock_net(sk), &opt, optval, optlen);