Skip to contentSkip to conversation

attr: replace if (cond) BUG() with BUG_ON()

PATCH New Jiapeng Chong 1 participant 1 message Mar 17, 2021 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 attr: replace if (cond) BUG() with BUG_ON()

Fix the following coccicheck warnings:

./fs/attr.c:349:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG.

---
 fs/attr.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
fs/attr.c +1 -3
index 87ef39d..43f369e 100644
@@ -344,9 +344,7 @@ int notify_change(struct user_namespace *mnt_userns, struct dentry *dentry,
 	 * no function will ever call notify_change with both ATTR_MODE and
 	 * ATTR_KILL_S*ID set.
 	 */
-	if ((ia_valid & (ATTR_KILL_SUID|ATTR_KILL_SGID)) &&
-	    (ia_valid & ATTR_MODE))
-		BUG();
+	BUG_ON((ia_valid & (ATTR_KILL_SUID|ATTR_KILL_SGID)) && (ia_valid & ATTR_MODE));
 
 	if (ia_valid & ATTR_KILL_SUID) {
 		if (mode & S_ISUID) {
Signature · 1 line
1.8.3.1