Skip to contentSkip to conversation

ima: Use inode_is_open_for_write

PATCH In review Nikolay Borisov 2 participants 2 messages Dec 11, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ima: Use inode_is_open_for_write

Use the aptly named function rather than open coding the check. No functional changes.

---
 security/integrity/ima/ima_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/integrity/ima/ima_main.c +1 -1
index 1b88d58e1325..05fbf8a2fa42 100644
@@ -103,7 +103,7 @@ static void ima_rdwr_violation_check(struct file *file,
 	} else {
 		if (must_measure)
 			set_bit(IMA_MUST_MEASURE, &iint->atomic_flags);
-		if ((atomic_read(&inode->i_writecount) > 0) && must_measure)
+		if (inode_is_open_for_write(inode) && must_measure)
 			send_writers = true;
 	}
 
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 4 lines · Nikolay Borisov

Use the aptly named function rather than open coding the check. No functional changes.

Thanks.  This patch is now in the #next-integrity branch.

Mimi

Quoted 17 lines
---
 security/integrity/ima/ima_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/integrity/ima/ima_main.c +1 -1
index 1b88d58e1325..05fbf8a2fa42 100644
@@ -103,7 +103,7 @@ static void ima_rdwr_violation_check(struct file *file,
 	} else {
 		if (must_measure)
 			set_bit(IMA_MUST_MEASURE, &iint->atomic_flags);
-		if ((atomic_read(&inode->i_writecount) > 0) && must_measure)
+		if (inode_is_open_for_write(inode) && must_measure)
 			send_writers = true;
 	}