Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Dec 1995 15:01:06 +0900
From:      KATO Takenori <kato@eclogite.eps.nagoya-u.ac.jp>
To:        current@FreeBSD.ORG
Subject:   Re: return value of ffs_blkpref()
Message-ID:  <199512250601.PAA03702@marble.eps.nagoya-u.ac.jp>
In-Reply-To: Your message of "Sun, 24 Dec 1995 16:08:18 %2B0900"
References:  <199512240708.QAA00452@marble.eps.nagoya-u.ac.jp>

next in thread | previous in thread | raw e-mail | index | archive | help
On 24 Dec 1995, I wrote:

> But ffs_clusteralloc doesn't check pref is correct or not.

One of the solution of this problem is as follows:

*** ffs_alloc.c.orig	Mon Dec 25 14:53:59 1995
--- ffs_alloc.c	Mon Dec 25 14:56:22 1995
***************
*** 1058,1065 ****
  	 */
  	if (dtog(fs, bpref) != cg)
  		bpref = 0;
! 	else
! 		bpref = fragstoblks(fs, dtogd(fs, blknum(fs, bpref)));
  	mapp = &cg_clustersfree(cgp)[bpref / NBBY];
  	map = *mapp++;
  	bit = 1 << (bpref % NBBY);
--- 1058,1069 ----
  	 */
  	if (dtog(fs, bpref) != cg)
  		bpref = 0;
! 	else {
! 		if (bpref >= fs->fs_size)
! 			bpref = 0;
! 		else
! 			bpref = fragstoblks(fs, dtogd(fs, blknum(fs, bpref)));
! 	}
  	mapp = &cg_clustersfree(cgp)[bpref / NBBY];
  	map = *mapp++;
  	bit = 1 << (bpref % NBBY);


----
KATO Takenori <kato@eclogite.eps.nagoya-u.ac.jp>
Dept. Earth Planet. Sci., Nagoya Univ.,  Nagoya 464-01
Voice: +81-52-789-2529   Fax: +81-52-789-3033



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