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
This commit is contained in:
parent
4a44a3d569
commit
bad15605e4
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user