Fix a DIV0 in case a large value for fs_avgfilesize or fs_avgfpdir
is given (with newfs or tunefs) and dirsize overflows. In case dirsize is <= 0 because of an overflow set maxcontigdirs to 0 so it will be 1 later. This is what would happen for large fs_avgfilesize. [1] Identified with help from: roberto, pjd Submitted by: pjd [1] Approved by: re (rwatson) MFC after: 8 days
This commit is contained in:
parent
73474451b9
commit
7fd627f00f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=172113
@ -1073,6 +1073,9 @@ ffs_dirpref(pip)
|
||||
curdirsize = avgndir ? (cgsize - avgbfree * fs->fs_bsize) / avgndir : 0;
|
||||
if (dirsize < curdirsize)
|
||||
dirsize = curdirsize;
|
||||
if (dirsize <= 0)
|
||||
maxcontigdirs = 0; /* dirsize overflowed */
|
||||
else
|
||||
maxcontigdirs = min((avgbfree * fs->fs_bsize) / dirsize, 255);
|
||||
if (fs->fs_avgfpdir > 0)
|
||||
maxcontigdirs = min(maxcontigdirs,
|
||||
|
Loading…
Reference in New Issue
Block a user