Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Aug 2000 11:18:48 +0200
From:      Brad Knowles <blk@skynet.be>
To:        freebsd-ports@freebsd.org
Subject:   spegla on systems with more than 2GB free and minfree > 0
Message-ID:  <v04220807b5c7f4eac65f@[195.238.1.121]>

next in thread | raw e-mail | index | archive | help
Folks,

	I just ran into an interesting bug with this.  It seems that line 
731 of spegla.c (from spegla-1.1p4) does some math mixing longs & 
ints:

		if (f.f_bsize * f.f_bavail) < minfree)

	However, if the filesystem has more than 2GB free, this causes 
the multiplication to exceed the limits of a signed int, and wrap 
around to become negative.

	By default, minfree is zero (which is checked for earlier), so 
most people probably don't run into this (although they could get 
nasty surprises with filesystems filling up and potentially crashing 
their machines).


	Anyway, casting this to "long" didn't seem to do the job on my 
machine.  Casting to "long long" seems to work fine.


	I've reported this to the author, but you might also want to 
consider a FreeBSD-specific patch for this problem.

--
   These are my opinions -- not to be taken as official Skynet policy
======================================================================
Brad Knowles, <blk@skynet.be>                || Belgacom Skynet SA/NV
Systems Architect, Mail/News/FTP/Proxy Admin || Rue Colonel Bourg, 124
Phone/Fax: +32-2-706.13.11/12.49             || B-1140 Brussels
http://www.skynet.be                         || Belgium

"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety."
     -Benjamin Franklin, Historical Review of Pennsylvania.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




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