Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 May 2014 20:04:32 +0400
From:      Andrey Chernov <ache@freebsd.org>
To:        Don Lewis <truckman@FreeBSD.org>, src-committers@freebsd.org,  svn-src-all@freebsd.org, svn-src-stable@freebsd.org,  svn-src-stable-10@freebsd.org
Subject:   Re: svn commit: r265901 - stable/10/sys/kern
Message-ID:  <5370F110.5050502@freebsd.org>
In-Reply-To: <201405120427.s4C4RAZf093033@svn.freebsd.org>
References:  <201405120427.s4C4RAZf093033@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 12.05.2014 8:27, Don Lewis wrote:
> +	if (start + amask < start) {
> +		DPRINTF(("start+amask wrapped around\n"));
> +		goto out;
> +	}

Checking for overflow _after_ it happens is unportable and dangerous,
since wrapping around is not only one possible result. They should be
rewritten like that:

if (start > ULONG_MAX - amask)


-- 
http://ache.vniz.net/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5370F110.5050502>