diff options
author | pfg <pfg@FreeBSD.org> | 2015-01-28 15:36:24 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2015-01-28 15:36:24 +0000 |
commit | bad15605e4ea23b91de9e414acefb14de141a71e (patch) | |
tree | 748623ac73a6da3ba8a4ef96f13ab957376a2f15 | |
parent | 4a44a3d569899bc1c25916c16dd29ac8a6c47082 (diff) | |
download | FreeBSD-src-bad15605e4ea23b91de9e414acefb14de141a71e.zip FreeBSD-src-bad15605e4ea23b91de9e414acefb14de141a71e.tar.gz |
MFC r277340, r277349:
Remove dead code.
After the ext2 variant of the "orlov allocator" was implemented,
the case for a negative or zero dirsize disappeared.
Drop the dead code and unsign dirsize given that it can't be
negative anyways.
ext2fs: fix for uninitialized pointer read.
path.ep_bp was being used uninitialized in ext4_ext_find_extent().
CID: 1062344
CID: 1008669
-rw-r--r-- | sys/fs/ext2fs/ext2_alloc.c | 9 | ||||
-rw-r--r-- | sys/fs/ext2fs/ext2_bmap.c | 2 |
2 files changed, 4 insertions, 7 deletions
diff --git a/sys/fs/ext2fs/ext2_alloc.c b/sys/fs/ext2fs/ext2_alloc.c index 106a124..702a365 100644 --- a/sys/fs/ext2fs/ext2_alloc.c +++ b/sys/fs/ext2fs/ext2_alloc.c @@ -443,11 +443,11 @@ static u_long ext2_dirpref(struct inode *pip) { struct m_ext2fs *fs; - int cg, prefcg, dirsize, cgsize; + int cg, prefcg, cgsize; u_int avgifree, avgbfree, avgndir, curdirsize; u_int minifree, minbfree, maxndir; u_int mincg, minndir; - u_int maxcontigdirs; + u_int dirsize, maxcontigdirs; mtx_assert(EXT2_MTX(pip->i_ump), MA_OWNED); fs = pip->i_e2fs; @@ -498,10 +498,7 @@ ext2_dirpref(struct inode *pip) curdirsize = avgndir ? (cgsize - avgbfree * fs->e2fs_bsize) / avgndir : 0; if (dirsize < curdirsize) dirsize = curdirsize; - if (dirsize <= 0) - maxcontigdirs = 0; /* dirsize overflowed */ - else - maxcontigdirs = min((avgbfree * fs->e2fs_bsize) / dirsize, 255); + maxcontigdirs = min((avgbfree * fs->e2fs_bsize) / dirsize, 255); maxcontigdirs = min(maxcontigdirs, fs->e2fs_ipg / AFPDIR); if (maxcontigdirs == 0) maxcontigdirs = 1; diff --git a/sys/fs/ext2fs/ext2_bmap.c b/sys/fs/ext2fs/ext2_bmap.c index ce64858..12f9560 100644 --- a/sys/fs/ext2fs/ext2_bmap.c +++ b/sys/fs/ext2fs/ext2_bmap.c @@ -94,7 +94,7 @@ ext4_bmapext(struct vnode *vp, int32_t bn, int64_t *bnp, int *runp, int *runb) struct inode *ip; struct m_ext2fs *fs; struct ext4_extent *ep; - struct ext4_extent_path path; + struct ext4_extent_path path = { .ep_bp = NULL }; daddr_t lbn; ip = VTOI(vp); |