Skip to contentSkip to conversation

hugetlbfs: Remove useless BUG_ON(!inode) in hugetlbfs_setattr()

PATCH Applied Miaohe Lin 2 participants 2 messages Jan 18, 2021 – Jan 19, 2021

Subsystems (2)
lore
Share & tools
lore

Miaohe Lin

author
#0 lore raw

PATCH v2 1/1 hugetlbfs: Remove useless BUG_ON(!inode) in hugetlbfs_setattr()

When we reach here with inode = NULL, we should have crashed as inode has already been dereferenced via hstate_inode. So this BUG_ON(!inode) does not take effect and should be removed.

---
 fs/hugetlbfs/inode.c | 2 --
 1 file changed, 2 deletions(-)
fs/hugetlbfs/inode.c +0 -2
index 016c863b493b..79464963f95e 100644
@@ -759,8 +759,6 @@ static int hugetlbfs_setattr(struct dentry *dentry, struct iattr *attr)
 	unsigned int ia_valid = attr->ia_valid;
 	struct hugetlbfs_inode_info *info = HUGETLBFS_I(inode);
 
-	BUG_ON(!inode);
-
 	error = setattr_prepare(dentry, attr);
 	if (error)
 		return error;
Signature · 1 line
2.19.1
Reviewed-by on v2 1/1
#1 lore raw

CC Andrew

Quoted 8 lines · Miaohe Lin

When we reach here with inode = NULL, we should have crashed as inode has already been dereferenced via hstate_inode. So this BUG_ON(!inode) does not take effect and should be removed.

---
 fs/hugetlbfs/inode.c | 2 --
 1 file changed, 2 deletions(-)

Thanks,

Signature · 1 line
Mike Kravetz
Quoted 15 lines
fs/hugetlbfs/inode.c +0 -2
index 016c863b493b..79464963f95e 100644
@@ -759,8 +759,6 @@ static int hugetlbfs_setattr(struct dentry *dentry, struct iattr *attr)
 	unsigned int ia_valid = attr->ia_valid;
 	struct hugetlbfs_inode_info *info = HUGETLBFS_I(inode);
 
-	BUG_ON(!inode);
-
 	error = setattr_prepare(dentry, attr);
 	if (error)
 		return error;