ext2fs: Stop checking for failures from malloc(M_WAITOK).
PR: 240545 Submitted by: Andrew Reiter <arr@watson.org> Reviewed by: fsu MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25707
This commit is contained in:
parent
fcc9702f05
commit
39bc40e3d2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=363367
@ -234,8 +234,6 @@ ext2_getacl_posix1e(struct vop_getacl_args *ap)
|
|||||||
|
|
||||||
len = sizeof(*ap->a_aclp) + sizeof(struct ext2_acl_header);
|
len = sizeof(*ap->a_aclp) + sizeof(struct ext2_acl_header);
|
||||||
value = malloc(len, M_ACL, M_WAITOK);
|
value = malloc(len, M_ACL, M_WAITOK);
|
||||||
if (!value)
|
|
||||||
return (ENOMEM);
|
|
||||||
|
|
||||||
error = vn_extattr_get(ap->a_vp, IO_NODELOCKED, attrnamespace, attrname,
|
error = vn_extattr_get(ap->a_vp, IO_NODELOCKED, attrnamespace, attrname,
|
||||||
&len, value, ap->a_td);
|
&len, value, ap->a_td);
|
||||||
|
@ -425,9 +425,6 @@ ext2_valloc(struct vnode *pvp, int mode, struct ucred *cred, struct vnode **vpp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ip = malloc(sizeof(struct inode), M_EXT2NODE, M_WAITOK | M_ZERO);
|
ip = malloc(sizeof(struct inode), M_EXT2NODE, M_WAITOK | M_ZERO);
|
||||||
if (ip == NULL) {
|
|
||||||
return (ENOMEM);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate a new vnode/inode. */
|
/* Allocate a new vnode/inode. */
|
||||||
if ((error = getnewvnode("ext2fs", ump->um_mountp, &ext2_vnodeops, &vp)) != 0) {
|
if ((error = getnewvnode("ext2fs", ump->um_mountp, &ext2_vnodeops, &vp)) != 0) {
|
||||||
|
@ -322,9 +322,6 @@ ext4_ext_fill_path_bdata(struct ext4_extent_path *path,
|
|||||||
("ext4_ext_fill_path_bdata: bad ep_data"));
|
("ext4_ext_fill_path_bdata: bad ep_data"));
|
||||||
|
|
||||||
path->ep_data = malloc(bp->b_bufsize, M_EXT2EXTENTS, M_WAITOK);
|
path->ep_data = malloc(bp->b_bufsize, M_EXT2EXTENTS, M_WAITOK);
|
||||||
if (!path->ep_data)
|
|
||||||
return (ENOMEM);
|
|
||||||
|
|
||||||
memcpy(path->ep_data, bp->b_data, bp->b_bufsize);
|
memcpy(path->ep_data, bp->b_data, bp->b_bufsize);
|
||||||
path->ep_blk = blk;
|
path->ep_blk = blk;
|
||||||
|
|
||||||
@ -397,9 +394,6 @@ ext4_ext_find_extent(struct inode *ip, daddr_t block,
|
|||||||
path = malloc(EXT4_EXT_DEPTH_MAX *
|
path = malloc(EXT4_EXT_DEPTH_MAX *
|
||||||
sizeof(struct ext4_extent_path),
|
sizeof(struct ext4_extent_path),
|
||||||
M_EXT2EXTENTS, M_WAITOK | M_ZERO);
|
M_EXT2EXTENTS, M_WAITOK | M_ZERO);
|
||||||
if (!path)
|
|
||||||
return (ENOMEM);
|
|
||||||
|
|
||||||
*ppath = path;
|
*ppath = path;
|
||||||
alloc = 1;
|
alloc = 1;
|
||||||
}
|
}
|
||||||
@ -762,8 +756,6 @@ ext4_ext_split(struct inode *ip, struct ext4_extent_path *path,
|
|||||||
/* Allocate new blocks. */
|
/* Allocate new blocks. */
|
||||||
ablks = malloc(sizeof(e4fs_daddr_t) * depth,
|
ablks = malloc(sizeof(e4fs_daddr_t) * depth,
|
||||||
M_EXT2EXTENTS, M_WAITOK | M_ZERO);
|
M_EXT2EXTENTS, M_WAITOK | M_ZERO);
|
||||||
if (!ablks)
|
|
||||||
return (ENOMEM);
|
|
||||||
for (a = 0; a < depth - at; a++) {
|
for (a = 0; a < depth - at; a++) {
|
||||||
newblk = ext4_ext_alloc_meta(ip);
|
newblk = ext4_ext_alloc_meta(ip);
|
||||||
if (newblk == 0)
|
if (newblk == 0)
|
||||||
@ -1517,9 +1509,6 @@ ext4_ext_remove_space(struct inode *ip, off_t length, int flags,
|
|||||||
|
|
||||||
path = malloc(sizeof(struct ext4_extent_path) * (depth + 1),
|
path = malloc(sizeof(struct ext4_extent_path) * (depth + 1),
|
||||||
M_EXT2EXTENTS, M_WAITOK | M_ZERO);
|
M_EXT2EXTENTS, M_WAITOK | M_ZERO);
|
||||||
if (!path)
|
|
||||||
return (ENOMEM);
|
|
||||||
|
|
||||||
path[0].ep_header = ehp;
|
path[0].ep_header = ehp;
|
||||||
path[0].ep_depth = depth;
|
path[0].ep_depth = depth;
|
||||||
i = 0;
|
i = 0;
|
||||||
|
@ -894,10 +894,6 @@ ext2_add_first_entry(struct vnode *dvp, struct ext2fs_direct_2 *entry,
|
|||||||
entry->e2d_reclen = htole16(dirblksize -
|
entry->e2d_reclen = htole16(dirblksize -
|
||||||
sizeof(struct ext2fs_direct_tail));
|
sizeof(struct ext2fs_direct_tail));
|
||||||
buf = malloc(dirblksize, M_TEMP, M_WAITOK);
|
buf = malloc(dirblksize, M_TEMP, M_WAITOK);
|
||||||
if (!buf) {
|
|
||||||
error = ENOMEM;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
memcpy(buf, entry, EXT2_DIR_REC_LEN(entry->e2d_namlen));
|
memcpy(buf, entry, EXT2_DIR_REC_LEN(entry->e2d_namlen));
|
||||||
ext2_init_dirent_tail(EXT2_DIRENT_TAIL(buf, dirblksize));
|
ext2_init_dirent_tail(EXT2_DIRENT_TAIL(buf, dirblksize));
|
||||||
ext2_dirent_csum_set(dp, (struct ext2fs_direct_2 *)buf);
|
ext2_dirent_csum_set(dp, (struct ext2fs_direct_2 *)buf);
|
||||||
|
@ -1077,10 +1077,6 @@ ext2_rename(struct vop_rename_args *ap)
|
|||||||
ext2_dec_nlink(dp);
|
ext2_dec_nlink(dp);
|
||||||
dp->i_flag |= IN_CHANGE;
|
dp->i_flag |= IN_CHANGE;
|
||||||
dirbuf = malloc(dp->i_e2fs->e2fs_bsize, M_TEMP, M_WAITOK | M_ZERO);
|
dirbuf = malloc(dp->i_e2fs->e2fs_bsize, M_TEMP, M_WAITOK | M_ZERO);
|
||||||
if (!dirbuf) {
|
|
||||||
error = ENOMEM;
|
|
||||||
goto bad;
|
|
||||||
}
|
|
||||||
error = vn_rdwr(UIO_READ, fvp, (caddr_t)dirbuf,
|
error = vn_rdwr(UIO_READ, fvp, (caddr_t)dirbuf,
|
||||||
ip->i_e2fs->e2fs_bsize, (off_t)0,
|
ip->i_e2fs->e2fs_bsize, (off_t)0,
|
||||||
UIO_SYSSPACE, IO_NODELOCKED | IO_NOMACCHECK,
|
UIO_SYSSPACE, IO_NODELOCKED | IO_NOMACCHECK,
|
||||||
@ -1390,12 +1386,6 @@ ext2_mkdir(struct vop_mkdir_args *ap)
|
|||||||
#define DIRBLKSIZ VTOI(dvp)->i_e2fs->e2fs_bsize
|
#define DIRBLKSIZ VTOI(dvp)->i_e2fs->e2fs_bsize
|
||||||
dirtemplate.dotdot_reclen = htole16(DIRBLKSIZ - 12);
|
dirtemplate.dotdot_reclen = htole16(DIRBLKSIZ - 12);
|
||||||
buf = malloc(DIRBLKSIZ, M_TEMP, M_WAITOK | M_ZERO);
|
buf = malloc(DIRBLKSIZ, M_TEMP, M_WAITOK | M_ZERO);
|
||||||
if (!buf) {
|
|
||||||
error = ENOMEM;
|
|
||||||
ext2_dec_nlink(dp);
|
|
||||||
dp->i_flag |= IN_CHANGE;
|
|
||||||
goto bad;
|
|
||||||
}
|
|
||||||
if (EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_METADATA_CKSUM)) {
|
if (EXT2_HAS_RO_COMPAT_FEATURE(fs, EXT2F_ROCOMPAT_METADATA_CKSUM)) {
|
||||||
dirtemplate.dotdot_reclen =
|
dirtemplate.dotdot_reclen =
|
||||||
htole16(le16toh(dirtemplate.dotdot_reclen) -
|
htole16(le16toh(dirtemplate.dotdot_reclen) -
|
||||||
|
Loading…
Reference in New Issue
Block a user