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>
This commit is contained in:
parent
09b1148ef5
commit
2bb930abcf
security/integrity
@ -32,19 +32,19 @@ extern struct crypto_shash *hash_tfm;
|
||||
/* List of EVM protected security xattrs */
|
||||
extern char *evm_config_xattrnames[];
|
||||
|
||||
extern int evm_init_key(void);
|
||||
extern int evm_update_evmxattr(struct dentry *dentry,
|
||||
int evm_init_key(void);
|
||||
int evm_update_evmxattr(struct dentry *dentry,
|
||||
const char *req_xattr_name,
|
||||
const char *req_xattr_value,
|
||||
size_t req_xattr_value_len);
|
||||
extern int evm_calc_hmac(struct dentry *dentry, const char *req_xattr_name,
|
||||
int evm_calc_hmac(struct dentry *dentry, const char *req_xattr_name,
|
||||
const char *req_xattr_value,
|
||||
size_t req_xattr_value_len, char *digest);
|
||||
extern int evm_calc_hash(struct dentry *dentry, const char *req_xattr_name,
|
||||
int evm_calc_hash(struct dentry *dentry, const char *req_xattr_name,
|
||||
const char *req_xattr_value,
|
||||
size_t req_xattr_value_len, char *digest);
|
||||
extern int evm_init_hmac(struct inode *inode, const struct xattr *xattr,
|
||||
int evm_init_hmac(struct inode *inode, const struct xattr *xattr,
|
||||
char *hmac_val);
|
||||
extern int evm_init_secfs(void);
|
||||
int evm_init_secfs(void);
|
||||
|
||||
#endif
|
||||
|
@ -105,13 +105,13 @@ static void hmac_add_misc(struct shash_desc *desc, struct inode *inode,
|
||||
umode_t mode;
|
||||
} hmac_misc;
|
||||
|
||||
memset(&hmac_misc, 0, sizeof hmac_misc);
|
||||
memset(&hmac_misc, 0, sizeof(hmac_misc));
|
||||
hmac_misc.ino = inode->i_ino;
|
||||
hmac_misc.generation = inode->i_generation;
|
||||
hmac_misc.uid = from_kuid(&init_user_ns, inode->i_uid);
|
||||
hmac_misc.gid = from_kgid(&init_user_ns, inode->i_gid);
|
||||
hmac_misc.mode = inode->i_mode;
|
||||
crypto_shash_update(desc, (const u8 *)&hmac_misc, sizeof hmac_misc);
|
||||
crypto_shash_update(desc, (const u8 *)&hmac_misc, sizeof(hmac_misc));
|
||||
if (evm_hmac_version > 1)
|
||||
crypto_shash_update(desc, inode->i_sb->s_uuid,
|
||||
sizeof(inode->i_sb->s_uuid));
|
||||
|
@ -151,7 +151,7 @@ static void init_once(void *foo)
|
||||
{
|
||||
struct integrity_iint_cache *iint = foo;
|
||||
|
||||
memset(iint, 0, sizeof *iint);
|
||||
memset(iint, 0, sizeof(*iint));
|
||||
iint->version = 0;
|
||||
iint->flags = 0UL;
|
||||
iint->ima_file_status = INTEGRITY_UNKNOWN;
|
||||
|
@ -133,14 +133,14 @@ static int ima_measurements_show(struct seq_file *m, void *v)
|
||||
* PCR used is always the same (config option) in
|
||||
* little-endian format
|
||||
*/
|
||||
ima_putc(m, &pcr, sizeof pcr);
|
||||
ima_putc(m, &pcr, sizeof(pcr));
|
||||
|
||||
/* 2nd: template digest */
|
||||
ima_putc(m, e->digest, TPM_DIGEST_SIZE);
|
||||
|
||||
/* 3rd: template name size */
|
||||
namelen = strlen(e->template_desc->name);
|
||||
ima_putc(m, &namelen, sizeof namelen);
|
||||
ima_putc(m, &namelen, sizeof(namelen));
|
||||
|
||||
/* 4th: template name */
|
||||
ima_putc(m, e->template_desc->name, namelen);
|
||||
|
@ -522,8 +522,7 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
|
||||
break;
|
||||
}
|
||||
|
||||
result = kstrtoul(args[0].from, 16,
|
||||
&entry->fsmagic);
|
||||
result = kstrtoul(args[0].from, 16, &entry->fsmagic);
|
||||
if (!result)
|
||||
entry->flags |= IMA_FSMAGIC;
|
||||
break;
|
||||
|
@ -117,7 +117,7 @@ int ima_add_template_entry(struct ima_template_entry *entry, int violation,
|
||||
|
||||
mutex_lock(&ima_extend_list_mutex);
|
||||
if (!violation) {
|
||||
memcpy(digest, entry->digest, sizeof digest);
|
||||
memcpy(digest, entry->digest, sizeof(digest));
|
||||
if (ima_lookup_digest_entry(digest)) {
|
||||
audit_cause = "hash_exists";
|
||||
result = -EEXIST;
|
||||
@ -133,7 +133,7 @@ int ima_add_template_entry(struct ima_template_entry *entry, int violation,
|
||||
}
|
||||
|
||||
if (violation) /* invalidate pcr */
|
||||
memset(digest, 0xff, sizeof digest);
|
||||
memset(digest, 0xff, sizeof(digest));
|
||||
|
||||
tpmresult = ima_pcr_extend(digest);
|
||||
if (tpmresult != 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user