From patchwork Thu Nov 7 07:42:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 3151421 Return-Path: X-Original-To: patchwork-ocfs2-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6D524BEEB2 for ; Thu, 7 Nov 2013 07:43:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9445F20628 for ; Thu, 7 Nov 2013 07:43:38 +0000 (UTC) Received: from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 94C0920625 for ; Thu, 7 Nov 2013 07:43:37 +0000 (UTC) Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id rA77hK6Q005658 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 7 Nov 2013 07:43:21 GMT Received: from oss.oracle.com (oss-external.oracle.com [137.254.96.51]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rA77hFtk020763 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 7 Nov 2013 07:43:15 GMT Received: from localhost ([127.0.0.1] helo=oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1VeKFH-0005t5-CY; Wed, 06 Nov 2013 23:43:15 -0800 Received: from acsinet22.oracle.com ([141.146.126.238]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1VeKEj-0005si-2d for ocfs2-devel@oss.oracle.com; Wed, 06 Nov 2013 23:42:41 -0800 Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rA77gdmS019445 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 7 Nov 2013 07:42:40 GMT Received: from abhmt105.oracle.com (abhmt105.oracle.com [141.146.116.57]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rA77gdoD003616; Thu, 7 Nov 2013 07:42:39 GMT Received: from elgon.mountain (/41.202.233.179) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 06 Nov 2013 23:42:38 -0800 Date: Thu, 7 Nov 2013 10:42:32 +0300 From: Dan Carpenter To: Mark Fasheh , Goldwyn Rodrigues Message-ID: <20131107074232.GC21844@elgon.mountain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Cc: kernel-janitors@vger.kernel.org, ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [patch] ocfs2: remove some impossible checks X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP pv_major and pv_minor are unsigned char type so these checks are just noise. Signed-off-by: Dan Carpenter diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c index 4599de7..eca3f93 100644 --- a/fs/ocfs2/stack_user.c +++ b/fs/ocfs2/stack_user.c @@ -808,11 +808,7 @@ static int lvb_to_version(char *lvb, struct ocfs2_protocol_version *ver) &ocfs2_user_plugin.sp_max_proto; memcpy(&pv, lvb, sizeof(struct ocfs2_protocol_version)); - if ((pv.pv_major == LONG_MIN) || (pv.pv_major == LONG_MAX) || - (pv.pv_major > (u8)-1) || (pv.pv_major < 1)) - return -ERANGE; - if ((pv.pv_minor == LONG_MIN) || (pv.pv_minor == LONG_MAX) || - (pv.pv_minor > (u8)-1) || (pv.pv_minor < 0)) + if (pv.pv_major < 1) return -ERANGE; if ((pv.pv_major != max->pv_major) || (pv.pv_minor > max->pv_minor))