diff options
-rw-r--r-- | sys/ufs/ffs/ffs_alloc.c | 6 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index f285b4dab63..928f024a095 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_alloc.c,v 1.44 2003/06/02 23:28:22 millert Exp $ */ +/* $OpenBSD: ffs_alloc.c,v 1.45 2003/10/17 15:08:11 mpech Exp $ */ /* $NetBSD: ffs_alloc.c,v 1.11 1996/05/11 18:27:09 mycroft Exp $ */ /* @@ -624,7 +624,7 @@ ffs_inode_alloc(struct inode *pip, int mode, struct ucred *cred, * Need a way to preserve randomization. */ if (ip->i_ffs_gen == 0 || ++(ip->i_ffs_gen) == 0) - ip->i_ffs_gen = arc4random(); + ip->i_ffs_gen = arc4random() & INT_MAX; if (ip->i_ffs_gen == 0 || ip->i_ffs_gen == -1) ip->i_ffs_gen = 1; /* shouldn't happen */ return (0); @@ -669,7 +669,7 @@ ffs_dirpref(pip) * Force allocation in another cg if creating a first level dir. */ if (ITOV(pip)->v_flag & VROOT) { - prefcg = arc4random() % fs->fs_ncg; + prefcg = (arc4random() & INT_MAX) % fs->fs_ncg; mincg = prefcg; minndir = fs->fs_ipg; for (cg = prefcg; cg < fs->fs_ncg; cg++) diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index dcaacc3b195..4d0e448eba8 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_vfsops.c,v 1.60 2003/10/04 18:47:08 mickey Exp $ */ +/* $OpenBSD: ffs_vfsops.c,v 1.61 2003/10/17 15:08:11 mpech Exp $ */ /* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */ /* @@ -1232,7 +1232,7 @@ retry: * already have one. This should only happen on old filesystems. */ if (ip->i_ffs_gen == 0) { - ip->i_ffs_gen = arc4random(); + ip->i_ffs_gen = arc4random() & INT_MAX; if (ip->i_ffs_gen == 0 || ip->i_ffs_gen == -1) ip->i_ffs_gen = 1; /* shouldn't happen */ if ((vp->v_mount->mnt_flag & MNT_RDONLY) == 0) |