Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Jun 2010 15:12:54 +0400
From:      Andrey Chernov <ache@nagual.pp.ru>
To:        "Andrey V. Elsukov" <ae@FreeBSD.ORG>
Cc:        svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG
Subject:   Re: svn commit: r209388 - in head/sbin/geom: class/part core misc
Message-ID:  <20100621111254.GA31917@nagual.pp.ru>
In-Reply-To: <201006210824.o5L8OpFD067283@svn.freebsd.org>
References:  <201006210824.o5L8OpFD067283@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jun 21, 2010 at 08:24:51AM +0000, Andrey V. Elsukov wrote:
> +done:
> +	if (mult * unit < mult || number * mult * unit < number)
> +		return (ERANGE);

A general rule is: don't check for overflow when it already occurs,
since result can be any, including valid ones.
Redo it to before overflow stage (using things like OFF_MAX / unit).

-- 
http://ache.pp.ru/



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