diff options
author | Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com> | 2017-10-17 20:53:14 -0400 |
---|---|---|
committer | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2017-11-08 15:16:36 -0500 |
commit | e5729f86a2987c9404f9b2fb494b9a6fc4412baf (patch) | |
tree | d6900eafd031f85f204f81410e95e41ffbf6778f | |
parent | 39adb92598a7466e00f72bb8a197d8811017418a (diff) |
ima: Remove redundant conditional operator
A non-zero value is converted to 1 when assigned to a bool variable, so the
conditional operator in is_ima_appraise_enabled is redundant.
The value of a comparison operator is either 1 or 0 so the conditional
operator in ima_inode_setxattr is redundant as well.
Confirmed that the patch is correct by comparing the object file from
before and after the patch. They are identical.
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
-rw-r--r-- | security/integrity/ima/ima_appraise.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c index 809ba70fbbbf..ec7dfa02c051 100644 --- a/security/integrity/ima/ima_appraise.c +++ b/security/integrity/ima/ima_appraise.c | |||
@@ -40,7 +40,7 @@ __setup("ima_appraise=", default_appraise_setup); | |||
40 | */ | 40 | */ |
41 | bool is_ima_appraise_enabled(void) | 41 | bool is_ima_appraise_enabled(void) |
42 | { | 42 | { |
43 | return (ima_appraise & IMA_APPRAISE_ENFORCE) ? 1 : 0; | 43 | return ima_appraise & IMA_APPRAISE_ENFORCE; |
44 | } | 44 | } |
45 | 45 | ||
46 | /* | 46 | /* |
@@ -405,7 +405,7 @@ int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name, | |||
405 | if (!xattr_value_len || (xvalue->type >= IMA_XATTR_LAST)) | 405 | if (!xattr_value_len || (xvalue->type >= IMA_XATTR_LAST)) |
406 | return -EINVAL; | 406 | return -EINVAL; |
407 | ima_reset_appraise_flags(d_backing_inode(dentry), | 407 | ima_reset_appraise_flags(d_backing_inode(dentry), |
408 | (xvalue->type == EVM_IMA_XATTR_DIGSIG) ? 1 : 0); | 408 | xvalue->type == EVM_IMA_XATTR_DIGSIG); |
409 | result = 0; | 409 | result = 0; |
410 | } | 410 | } |
411 | return result; | 411 | return result; |