ima: Use inode_is_open_for_write
diff mbox series

Message ID 20181211083140.21430-1-nborisov@suse.com
State New
Headers show
Series
  • ima: Use inode_is_open_for_write
Related show

Commit Message

Nikolay Borisov Dec. 11, 2018, 8:31 a.m. UTC
Use the aptly named function rather than open coding the check. No
functional changes.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 security/integrity/ima/ima_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mimi Zohar Dec. 11, 2018, 1:23 p.m. UTC | #1
On Tue, 2018-12-11 at 10:31 +0200, Nikolay Borisov wrote:
> Use the aptly named function rather than open coding the check. No
> functional changes.
> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>

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

Mimi

> ---
>  security/integrity/ima/ima_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
> index 1b88d58e1325..05fbf8a2fa42 100644
> --- a/security/integrity/ima/ima_main.c
> +++ b/security/integrity/ima/ima_main.c
> @@ -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;
>  	}
>

Patch
diff mbox series

diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
index 1b88d58e1325..05fbf8a2fa42 100644
--- a/security/integrity/ima/ima_main.c
+++ b/security/integrity/ima/ima_main.c
@@ -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;
 	}