Revert r327781, r328093, r328056:

ufs|ext2fs: Revert uses of mallocarray(9).

These aren't really useful: drop them.
Variable unsigning will be brought again later.
This commit is contained in:
Pedro F. Giffuni 2018-01-24 16:44:57 +00:00
parent 18dffafade
commit f9834d101a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=328340
6 changed files with 17 additions and 22 deletions

View file

@ -145,9 +145,9 @@ ext2_readdir(struct vop_readdir_args *ap)
off_t offset, startoffset;
size_t readcnt, skipcnt;
ssize_t startresid;
int ncookies;
int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize;
int error;
u_int ncookies;
if (uio->uio_offset < 0)
return (EINVAL);
@ -160,8 +160,7 @@ ext2_readdir(struct vop_readdir_args *ap)
ncookies = ip->i_size - uio->uio_offset;
ncookies = ncookies / (offsetof(struct ext2fs_direct_2,
e2d_namlen) + 4) + 1;
cookies = mallocarray(ncookies, sizeof(*cookies), M_TEMP,
M_WAITOK);
cookies = malloc(ncookies * sizeof(*cookies), M_TEMP, M_WAITOK);
*ap->a_ncookies = ncookies;
*ap->a_cookies = cookies;
} else {

View file

@ -400,9 +400,9 @@ compute_sb_data(struct vnode *devvp, struct ext2fs *es,
fs->e2fs_bsize / sizeof(struct ext2_gd));
}
fs->e2fs_gdbcount = howmany(fs->e2fs_gcount, e2fs_descpb);
fs->e2fs_gd = mallocarray(e2fs_gdbcount_alloc, fs->e2fs_bsize,
fs->e2fs_gd = malloc(e2fs_gdbcount_alloc * fs->e2fs_bsize,
M_EXT2MNT, M_WAITOK | M_ZERO);
fs->e2fs_contigdirs = mallocarray(fs->e2fs_gcount,
fs->e2fs_contigdirs = malloc(fs->e2fs_gcount *
sizeof(*fs->e2fs_contigdirs), M_EXT2MNT, M_WAITOK | M_ZERO);
/*
@ -683,8 +683,7 @@ ext2_mountfs(struct vnode *devvp, struct mount *mp)
for (i = 0; i < ump->um_e2fs->e2fs_gcount; i++, sump++) {
*lp++ = ump->um_e2fs->e2fs_contigsumsize;
sump->cs_init = 0;
sump->cs_sum = mallocarray(
ump->um_e2fs->e2fs_contigsumsize + 1,
sump->cs_sum = malloc((ump->um_e2fs->e2fs_contigsumsize + 1) *
sizeof(int32_t), M_EXT2MNT, M_WAITOK | M_ZERO);
}
}

View file

@ -648,7 +648,7 @@ ffs_snapshot(mp, snapfile)
* keep us out of deadlock until the full one is ready.
*/
if (xp == NULL) {
snapblklist = mallocarray(snaplistsize, sizeof(daddr_t),
snapblklist = malloc(snaplistsize * sizeof(daddr_t),
M_UFSMNT, M_WAITOK);
blkp = &snapblklist[1];
*blkp++ = lblkno(fs, fs->fs_sblockloc);
@ -729,7 +729,7 @@ ffs_snapshot(mp, snapfile)
/*
* Allocate space for the full list of preallocated snapshot blocks.
*/
snapblklist = mallocarray(snaplistsize, sizeof(daddr_t),
snapblklist = malloc(snaplistsize * sizeof(daddr_t),
M_UFSMNT, M_WAITOK);
ip->i_snapblklist = &snapblklist[1];
/*

View file

@ -2466,8 +2466,7 @@ softdep_mount(devvp, mp, fs, cred)
struct ufsmount *ump;
struct cg *cgp;
struct buf *bp;
u_int cyl, i;
int error;
int i, error, cyl;
sdp = malloc(sizeof(struct mount_softdeps), M_MOUNTDATA,
M_WAITOK | M_ZERO);
@ -2501,7 +2500,7 @@ softdep_mount(devvp, mp, fs, cred)
ump->bmsafemap_hashtbl = hashinit(1024, M_BMSAFEMAP,
&ump->bmsafemap_hash_size);
i = 1 << (ffs(desiredvnodes / 10) - 1);
ump->indir_hashtbl = mallocarray(i, sizeof(struct indir_hashhead),
ump->indir_hashtbl = malloc(i * sizeof(struct indir_hashhead),
M_FREEWORK, M_WAITOK);
ump->indir_hash_size = i - 1;
for (i = 0; i <= ump->indir_hash_size; i++)
@ -2628,8 +2627,8 @@ jblocks_create(void)
jblocks = malloc(sizeof(*jblocks), M_JBLOCKS, M_WAITOK | M_ZERO);
TAILQ_INIT(&jblocks->jb_segs);
jblocks->jb_avail = 10;
jblocks->jb_extent = mallocarray(jblocks->jb_avail,
sizeof(struct jextent), M_JBLOCKS, M_WAITOK | M_ZERO);
jblocks->jb_extent = malloc(sizeof(struct jextent) * jblocks->jb_avail,
M_JBLOCKS, M_WAITOK | M_ZERO);
return (jblocks);
}
@ -2714,7 +2713,7 @@ jblocks_add(jblocks, daddr, blocks)
/* Adding a new extent. */
if (++jblocks->jb_used == jblocks->jb_avail) {
jblocks->jb_avail *= 2;
jext = mallocarray(jblocks->jb_avail, sizeof(struct jextent),
jext = malloc(sizeof(struct jextent) * jblocks->jb_avail,
M_JBLOCKS, M_WAITOK | M_ZERO);
memcpy(jext, jblocks->jb_extent,
sizeof(struct jextent) * jblocks->jb_used);

View file

@ -349,8 +349,7 @@ ufsdirhash_build(struct inode *ip)
struct direct *ep;
struct vnode *vp;
doff_t bmask, pos;
int j, memreqd, slot;
u_int dirblocks, i, nblocks, narrays, nslots;
int dirblocks, i, j, memreqd, nblocks, narrays, nslots, slot;
/* Take care of a decreased sysctl value. */
while (ufs_dirhashmem > ufs_dirhashmaxmem) {
@ -416,11 +415,11 @@ ufsdirhash_build(struct inode *ip)
* Use non-blocking mallocs so that we will revert to a linear
* lookup on failure rather than potentially blocking forever.
*/
dh->dh_hash = mallocarray(narrays, sizeof(dh->dh_hash[0]),
dh->dh_hash = malloc(narrays * sizeof(dh->dh_hash[0]),
M_DIRHASH, M_NOWAIT | M_ZERO);
if (dh->dh_hash == NULL)
goto fail;
dh->dh_blkfree = mallocarray(nblocks, sizeof(dh->dh_blkfree[0]),
dh->dh_blkfree = malloc(nblocks * sizeof(dh->dh_blkfree[0]),
M_DIRHASH, M_NOWAIT);
if (dh->dh_blkfree == NULL)
goto fail;

View file

@ -2170,7 +2170,7 @@ ufs_readdir(ap)
off_t offset, startoffset;
size_t readcnt, skipcnt;
ssize_t startresid;
u_int ncookies;
int ncookies;
int error;
if (uio->uio_offset < 0)
@ -2185,8 +2185,7 @@ ufs_readdir(ap)
else if (ip->i_size - uio->uio_offset < ncookies)
ncookies = ip->i_size - uio->uio_offset;
ncookies = ncookies / (offsetof(struct direct, d_name) + 4) + 1;
cookies = mallocarray(ncookies, sizeof(*cookies), M_TEMP,
M_WAITOK);
cookies = malloc(ncookies * sizeof(*cookies), M_TEMP, M_WAITOK);
*ap->a_ncookies = ncookies;
*ap->a_cookies = cookies;
} else {