diff options
| author | Dmitry Kasatkin <d.kasatkin@samsung.com> | 2014-03-04 11:04:20 -0500 |
|---|---|---|
| committer | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2014-03-07 12:15:45 -0500 |
| commit | 2bb930abcf39d8be243ddb4583cf013ea2a750d6 (patch) | |
| tree | 678aa6a54c7d8ed5ce5fa441039a5f65e3d978e6 /security | |
| parent | 09b1148ef59c93d292a3355c00e9b5779b2ecad0 (diff) | |
integrity: fix checkpatch errors
Between checkpatch changes (eg. sizeof) and inconsistencies between
Lindent and checkpatch, unfixed checkpatch errors make it difficult
to see new errors. This patch fixes them. Some lines with over 80 chars
remained unchanged to improve code readability.
The "extern" keyword is removed from internal evm.h to make it consistent
with internal ima.h.
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Diffstat (limited to 'security')
| -rw-r--r-- | security/integrity/evm/evm.h | 28 | ||||
| -rw-r--r-- | security/integrity/evm/evm_crypto.c | 4 | ||||
| -rw-r--r-- | security/integrity/iint.c | 2 | ||||
| -rw-r--r-- | security/integrity/ima/ima_api.c | 8 | ||||
| -rw-r--r-- | security/integrity/ima/ima_crypto.c | 2 | ||||
| -rw-r--r-- | security/integrity/ima/ima_fs.c | 6 | ||||
| -rw-r--r-- | security/integrity/ima/ima_main.c | 4 | ||||
| -rw-r--r-- | security/integrity/ima/ima_policy.c | 65 | ||||
| -rw-r--r-- | security/integrity/ima/ima_queue.c | 4 | ||||
| -rw-r--r-- | security/integrity/ima/ima_template.c | 14 | ||||
| -rw-r--r-- | security/integrity/integrity_audit.c | 2 |
11 files changed, 69 insertions, 70 deletions
diff --git a/security/integrity/evm/evm.h b/security/integrity/evm/evm.h index 30bd1ec0232e..37c88ddb3cfe 100644 --- a/security/integrity/evm/evm.h +++ b/security/integrity/evm/evm.h | |||
| @@ -32,19 +32,19 @@ extern struct crypto_shash *hash_tfm; | |||
| 32 | /* List of EVM protected security xattrs */ | 32 | /* List of EVM protected security xattrs */ |
| 33 | extern char *evm_config_xattrnames[]; | 33 | extern char *evm_config_xattrnames[]; |
| 34 | 34 | ||
| 35 | extern int evm_init_key(void); | 35 | int evm_init_key(void); |
| 36 | extern int evm_update_evmxattr(struct dentry *dentry, | 36 | int evm_update_evmxattr(struct dentry *dentry, |
| 37 | const char *req_xattr_name, | 37 | const char *req_xattr_name, |
| 38 | const char *req_xattr_value, | 38 | const char *req_xattr_value, |
| 39 | size_t req_xattr_value_len); | 39 | size_t req_xattr_value_len); |
| 40 | extern int evm_calc_hmac(struct dentry *dentry, const char *req_xattr_name, | 40 | int evm_calc_hmac(struct dentry *dentry, const char *req_xattr_name, |
| 41 | const char *req_xattr_value, | 41 | const char *req_xattr_value, |
| 42 | size_t req_xattr_value_len, char *digest); | 42 | size_t req_xattr_value_len, char *digest); |
| 43 | extern int evm_calc_hash(struct dentry *dentry, const char *req_xattr_name, | 43 | int evm_calc_hash(struct dentry *dentry, const char *req_xattr_name, |
| 44 | const char *req_xattr_value, | 44 | const char *req_xattr_value, |
| 45 | size_t req_xattr_value_len, char *digest); | 45 | size_t req_xattr_value_len, char *digest); |
| 46 | extern int evm_init_hmac(struct inode *inode, const struct xattr *xattr, | 46 | int evm_init_hmac(struct inode *inode, const struct xattr *xattr, |
| 47 | char *hmac_val); | 47 | char *hmac_val); |
| 48 | extern int evm_init_secfs(void); | 48 | int evm_init_secfs(void); |
| 49 | 49 | ||
| 50 | #endif | 50 | #endif |
diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c index 9bd329f1927a..babd8626bf96 100644 --- a/security/integrity/evm/evm_crypto.c +++ b/security/integrity/evm/evm_crypto.c | |||
| @@ -105,13 +105,13 @@ static void hmac_add_misc(struct shash_desc *desc, struct inode *inode, | |||
| 105 | umode_t mode; | 105 | umode_t mode; |
| 106 | } hmac_misc; | 106 | } hmac_misc; |
| 107 | 107 | ||
| 108 | memset(&hmac_misc, 0, sizeof hmac_misc); | 108 | memset(&hmac_misc, 0, sizeof(hmac_misc)); |
| 109 | hmac_misc.ino = inode->i_ino; | 109 | hmac_misc.ino = inode->i_ino; |
| 110 | hmac_misc.generation = inode->i_generation; | 110 | hmac_misc.generation = inode->i_generation; |
| 111 | hmac_misc.uid = from_kuid(&init_user_ns, inode->i_uid); | 111 | hmac_misc.uid = from_kuid(&init_user_ns, inode->i_uid); |
| 112 | hmac_misc.gid = from_kgid(&init_user_ns, inode->i_gid); | 112 | hmac_misc.gid = from_kgid(&init_user_ns, inode->i_gid); |
| 113 | hmac_misc.mode = inode->i_mode; | 113 | hmac_misc.mode = inode->i_mode; |
| 114 | crypto_shash_update(desc, (const u8 *)&hmac_misc, sizeof hmac_misc); | 114 | crypto_shash_update(desc, (const u8 *)&hmac_misc, sizeof(hmac_misc)); |
| 115 | if (evm_hmac_version > 1) | 115 | if (evm_hmac_version > 1) |
| 116 | crypto_shash_update(desc, inode->i_sb->s_uuid, | 116 | crypto_shash_update(desc, inode->i_sb->s_uuid, |
| 117 | sizeof(inode->i_sb->s_uuid)); | 117 | sizeof(inode->i_sb->s_uuid)); |
diff --git a/security/integrity/iint.c b/security/integrity/iint.c index c49d3f14cbec..a521edf4cbd6 100644 --- a/security/integrity/iint.c +++ b/security/integrity/iint.c | |||
| @@ -151,7 +151,7 @@ static void init_once(void *foo) | |||
| 151 | { | 151 | { |
| 152 | struct integrity_iint_cache *iint = foo; | 152 | struct integrity_iint_cache *iint = foo; |
| 153 | 153 | ||
| 154 | memset(iint, 0, sizeof *iint); | 154 | memset(iint, 0, sizeof(*iint)); |
| 155 | iint->version = 0; | 155 | iint->version = 0; |
| 156 | iint->flags = 0UL; | 156 | iint->flags = 0UL; |
| 157 | iint->ima_file_status = INTEGRITY_UNKNOWN; | 157 | iint->ima_file_status = INTEGRITY_UNKNOWN; |
diff --git a/security/integrity/ima/ima_api.c b/security/integrity/ima/ima_api.c index 393b9d46c472..c6b4a732e89b 100644 --- a/security/integrity/ima/ima_api.c +++ b/security/integrity/ima/ima_api.c | |||
| @@ -160,10 +160,10 @@ err_out: | |||
| 160 | * @function: calling function (FILE_CHECK, BPRM_CHECK, MMAP_CHECK, MODULE_CHECK) | 160 | * @function: calling function (FILE_CHECK, BPRM_CHECK, MMAP_CHECK, MODULE_CHECK) |
| 161 | * | 161 | * |
| 162 | * The policy is defined in terms of keypairs: | 162 | * The policy is defined in terms of keypairs: |
| 163 | * subj=, obj=, type=, func=, mask=, fsmagic= | 163 | * subj=, obj=, type=, func=, mask=, fsmagic= |
| 164 | * subj,obj, and type: are LSM specific. | 164 | * subj,obj, and type: are LSM specific. |
| 165 | * func: FILE_CHECK | BPRM_CHECK | MMAP_CHECK | MODULE_CHECK | 165 | * func: FILE_CHECK | BPRM_CHECK | MMAP_CHECK | MODULE_CHECK |
| 166 | * mask: contains the permission mask | 166 | * mask: contains the permission mask |
| 167 | * fsmagic: hex value | 167 | * fsmagic: hex value |
| 168 | * | 168 | * |
| 169 | * Returns IMA_MEASURE, IMA_APPRAISE mask. | 169 | * Returns IMA_MEASURE, IMA_APPRAISE mask. |
| @@ -248,7 +248,7 @@ int ima_collect_measurement(struct integrity_iint_cache *iint, | |||
| 248 | * | 248 | * |
| 249 | * We only get here if the inode has not already been measured, | 249 | * We only get here if the inode has not already been measured, |
| 250 | * but the measurement could already exist: | 250 | * but the measurement could already exist: |
| 251 | * - multiple copies of the same file on either the same or | 251 | * - multiple copies of the same file on either the same or |
| 252 | * different filesystems. | 252 | * different filesystems. |
| 253 | * - the inode was previously flushed as well as the iint info, | 253 | * - the inode was previously flushed as well as the iint info, |
| 254 | * containing the hashing info. | 254 | * containing the hashing info. |
diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/ima_crypto.c index 99990578b7cd..d257e3631152 100644 --- a/security/integrity/ima/ima_crypto.c +++ b/security/integrity/ima/ima_crypto.c | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | * the Free Software Foundation, version 2 of the License. | 10 | * the Free Software Foundation, version 2 of the License. |
| 11 | * | 11 | * |
| 12 | * File: ima_crypto.c | 12 | * File: ima_crypto.c |
| 13 | * Calculates md5/sha1 file hash, template hash, boot-aggreate hash | 13 | * Calculates md5/sha1 file hash, template hash, boot-aggreate hash |
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 16 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
diff --git a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_fs.c index 468a3ba3c539..da92fcc08d15 100644 --- a/security/integrity/ima/ima_fs.c +++ b/security/integrity/ima/ima_fs.c | |||
| @@ -133,14 +133,14 @@ static int ima_measurements_show(struct seq_file *m, void *v) | |||
| 133 | * PCR used is always the same (config option) in | 133 | * PCR used is always the same (config option) in |
| 134 | * little-endian format | 134 | * little-endian format |
| 135 | */ | 135 | */ |
| 136 | ima_putc(m, &pcr, sizeof pcr); | 136 | ima_putc(m, &pcr, sizeof(pcr)); |
| 137 | 137 | ||
| 138 | /* 2nd: template digest */ | 138 | /* 2nd: template digest */ |
| 139 | ima_putc(m, e->digest, TPM_DIGEST_SIZE); | 139 | ima_putc(m, e->digest, TPM_DIGEST_SIZE); |
| 140 | 140 | ||
| 141 | /* 3rd: template name size */ | 141 | /* 3rd: template name size */ |
| 142 | namelen = strlen(e->template_desc->name); | 142 | namelen = strlen(e->template_desc->name); |
| 143 | ima_putc(m, &namelen, sizeof namelen); | 143 | ima_putc(m, &namelen, sizeof(namelen)); |
| 144 | 144 | ||
| 145 | /* 4th: template name */ | 145 | /* 4th: template name */ |
| 146 | ima_putc(m, e->template_desc->name, namelen); | 146 | ima_putc(m, e->template_desc->name, namelen); |
| @@ -292,7 +292,7 @@ static atomic_t policy_opencount = ATOMIC_INIT(1); | |||
| 292 | /* | 292 | /* |
| 293 | * ima_open_policy: sequentialize access to the policy file | 293 | * ima_open_policy: sequentialize access to the policy file |
| 294 | */ | 294 | */ |
| 295 | static int ima_open_policy(struct inode * inode, struct file * filp) | 295 | static int ima_open_policy(struct inode *inode, struct file *filp) |
| 296 | { | 296 | { |
| 297 | /* No point in being allowed to open it if you aren't going to write */ | 297 | /* No point in being allowed to open it if you aren't going to write */ |
| 298 | if (!(filp->f_flags & O_WRONLY)) | 298 | if (!(filp->f_flags & O_WRONLY)) |
diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c index 149ee1119f87..50413d02ac3a 100644 --- a/security/integrity/ima/ima_main.c +++ b/security/integrity/ima/ima_main.c | |||
| @@ -71,10 +71,10 @@ __setup("ima_hash=", hash_setup); | |||
| 71 | * ima_rdwr_violation_check | 71 | * ima_rdwr_violation_check |
| 72 | * | 72 | * |
| 73 | * Only invalidate the PCR for measured files: | 73 | * Only invalidate the PCR for measured files: |
| 74 | * - Opening a file for write when already open for read, | 74 | * - Opening a file for write when already open for read, |
| 75 | * results in a time of measure, time of use (ToMToU) error. | 75 | * results in a time of measure, time of use (ToMToU) error. |
| 76 | * - Opening a file for read when already open for write, | 76 | * - Opening a file for read when already open for write, |
| 77 | * could result in a file measurement error. | 77 | * could result in a file measurement error. |
| 78 | * | 78 | * |
| 79 | */ | 79 | */ |
| 80 | static void ima_rdwr_violation_check(struct file *file) | 80 | static void ima_rdwr_violation_check(struct file *file) |
diff --git | |||
