From owner-svn-src-head@FreeBSD.ORG Fri Feb 27 01:59:30 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8B26F1EC; Fri, 27 Feb 2015 01:59:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 76898AE1; Fri, 27 Feb 2015 01:59:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t1R1xUJL057521; Fri, 27 Feb 2015 01:59:30 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t1R1xUoh057520; Fri, 27 Feb 2015 01:59:30 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201502270159.t1R1xUoh057520@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 27 Feb 2015 01:59:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r279344 - head/lib/libc/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Feb 2015 01:59:30 -0000 Author: pfg Date: Fri Feb 27 01:59:29 2015 New Revision: 279344 URL: https://svnweb.freebsd.org/changeset/base/279344 Log: Hint out check for unsigned negative values. On FreeBSD socklen_t is unsigned so the check negative len in inet6_opt_append() is redundant and likely to be optimized away by the compiler. On other operating systems this is not necessarily so, and in the future we may want to sign it so leave the check in but place it in a secondary position as a subtle indication that the bogus check is intentional. Discussed with: rpaulo CID: 1017783 Modified: head/lib/libc/net/ip6opt.c Modified: head/lib/libc/net/ip6opt.c ============================================================================== --- head/lib/libc/net/ip6opt.c Fri Feb 27 01:20:17 2015 (r279343) +++ head/lib/libc/net/ip6opt.c Fri Feb 27 01:59:29 2015 (r279344) @@ -419,7 +419,7 @@ inet6_opt_append(void *extbuf, socklen_t * The option data length must have a value between 0 and 255, * inclusive, and is the length of the option data that follows. */ - if (len < 0 || len > 255) + if (len > 255 || len < 0 ) return(-1); /*