svn commit: r277833 - stable/9/sys/fs/ext2fs
Pedro F. Giffuni
pfg at FreeBSD.org
Wed Jan 28 15:37:36 UTC 2015
Author: pfg
Date: Wed Jan 28 15:37:35 2015
New Revision: 277833
URL: https://svnweb.freebsd.org/changeset/base/277833
Log:
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
Modified:
stable/9/sys/fs/ext2fs/ext2_alloc.c
stable/9/sys/fs/ext2fs/ext2_bmap.c
Directory Properties:
stable/9/sys/ (props changed)
stable/9/sys/fs/ (props changed)
Modified: stable/9/sys/fs/ext2fs/ext2_alloc.c
==============================================================================
--- stable/9/sys/fs/ext2fs/ext2_alloc.c Wed Jan 28 15:36:24 2015 (r277832)
+++ stable/9/sys/fs/ext2fs/ext2_alloc.c Wed Jan 28 15:37:35 2015 (r277833)
@@ -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;
Modified: stable/9/sys/fs/ext2fs/ext2_bmap.c
==============================================================================
--- stable/9/sys/fs/ext2fs/ext2_bmap.c Wed Jan 28 15:36:24 2015 (r277832)
+++ stable/9/sys/fs/ext2fs/ext2_bmap.c Wed Jan 28 15:37:35 2015 (r277833)
@@ -94,7 +94,7 @@ ext4_bmapext(struct vnode *vp, int32_t b
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);
More information about the svn-src-stable-9
mailing list