* [PATCH 15/18] security: Remove pr_fmt duplicate logging prefixes
2018-05-10 15:45 [PATCH 00/18] Convert default pr_fmt from empty to KBUILD_MODNAME Joe Perches
@ 2018-05-10 15:45 ` Joe Perches
2018-05-10 16:15 ` Paul Moore
2018-05-10 15:45 ` [PATCH 17/18] security: encrypted-keys: " Joe Perches
1 sibling, 1 reply; 5+ messages in thread
From: Joe Perches @ 2018-05-10 15:45 UTC (permalink / raw)
To: linux-security-module
Converting pr_fmt from a simple define to use KBUILD_MODNAME added
some duplicate logging prefixes to existing uses.
Remove them.
Signed-off-by: Joe Perches <joe@perches.com>
---
security/selinux/selinuxfs.c | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index c0cadbc5f85c..be8f186a6256 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -515,19 +515,19 @@ static int sel_make_policy_nodes(struct selinux_fs_info *fsi)
ret = sel_make_bools(fsi);
if (ret) {
- pr_err("SELinux: failed to load policy booleans\n");
+ pr_err("failed to load policy booleans\n");
return ret;
}
ret = sel_make_classes(fsi);
if (ret) {
- pr_err("SELinux: failed to load policy classes\n");
+ pr_err("failed to load policy classes\n");
return ret;
}
ret = sel_make_policycap(fsi);
if (ret) {
- pr_err("SELinux: failed to load policy capabilities\n");
+ pr_err("failed to load policy capabilities\n");
return ret;
}
@@ -570,7 +570,7 @@ static ssize_t sel_write_load(struct file *file, const char __user *buf,
length = security_load_policy(fsi->state, data, count);
if (length) {
- pr_warn_ratelimited("SELinux: failed to load policy\n");
+ pr_warn_ratelimited("failed to load policy\n");
goto out;
}
@@ -620,8 +620,8 @@ static ssize_t sel_write_context(struct file *file, char *buf, size_t size)
length = -ERANGE;
if (len > SIMPLE_TRANSACTION_LIMIT) {
- printk(KERN_ERR "SELinux: %s: context size (%u) exceeds "
- "payload max\n", __func__, len);
+ pr_err("%s: context size (%u) exceeds payload max\n",
+ __func__, len);
goto out;
}
@@ -956,8 +956,8 @@ static ssize_t sel_write_create(struct file *file, char *buf, size_t size)
length = -ERANGE;
if (len > SIMPLE_TRANSACTION_LIMIT) {
- printk(KERN_ERR "SELinux: %s: context size (%u) exceeds "
- "payload max\n", __func__, len);
+ pr_err("%s: context size (%u) exceeds payload max\n",
+ __func__, len);
goto out;
}
@@ -1147,8 +1147,8 @@ static ssize_t sel_write_member(struct file *file, char *buf, size_t size)
length = -ERANGE;
if (len > SIMPLE_TRANSACTION_LIMIT) {
- printk(KERN_ERR "SELinux: %s: context size (%u) exceeds "
- "payload max\n", __func__, len);
+ pr_err("%s: context size (%u) exceeds payload max\n",
+ __func__, len);
goto out;
}
@@ -1389,8 +1389,8 @@ static int sel_make_bools(struct selinux_fs_info *fsi)
ret = security_genfs_sid(fsi->state, "selinuxfs", page,
SECCLASS_FILE, &sid);
if (ret) {
- pr_warn_ratelimited("SELinux: no sid found, defaulting to security isid for %s\n",
- page);
+ pr_warn_ratelimited("no sid found, defaulting to security isid for %s\n",
+ page);
sid = SECINITSID_SECURITY;
}
@@ -1996,8 +1996,7 @@ static int sel_fill_super(struct super_block *sb, void *data, int silent)
goto err;
return 0;
err:
- printk(KERN_ERR "SELinux: %s: failed while creating inodes\n",
- __func__);
+ pr_err("%s: failed while creating inodes\n", __func__);
selinux_fs_info_free(sb);
@@ -2046,7 +2045,7 @@ static int __init init_sel_fs(void)
selinux_null.mnt = selinuxfs_mount = kern_mount(&sel_fs_type);
if (IS_ERR(selinuxfs_mount)) {
- printk(KERN_ERR "selinuxfs: could not mount!\n");
+ pr_err("selinuxfs: could not mount!\n");
err = PTR_ERR(selinuxfs_mount);
selinuxfs_mount = NULL;
}
--
2.15.0
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 17/18] security: encrypted-keys: Remove pr_fmt duplicate logging prefixes
2018-05-10 15:45 [PATCH 00/18] Convert default pr_fmt from empty to KBUILD_MODNAME Joe Perches
2018-05-10 15:45 ` [PATCH 15/18] security: Remove pr_fmt duplicate logging prefixes Joe Perches
@ 2018-05-10 15:45 ` Joe Perches
2018-05-10 18:09 ` James Morris
1 sibling, 1 reply; 5+ messages in thread
From: Joe Perches @ 2018-05-10 15:45 UTC (permalink / raw)
To: linux-security-module
Converting pr_fmt from a simple define to use KBUILD_MODNAME added
some duplicate logging prefixes to existing uses.
Remove them.
Signed-off-by: Joe Perches <joe@perches.com>
---
security/keys/encrypted-keys/encrypted.c | 63 ++++++++++++++------------------
1 file changed, 28 insertions(+), 35 deletions(-)
diff --git a/security/keys/encrypted-keys/encrypted.c b/security/keys/encrypted-keys/encrypted.c
index d92cbf9687c3..40a14d5c6ae5 100644
--- a/security/keys/encrypted-keys/encrypted.c
+++ b/security/keys/encrypted-keys/encrypted.c
@@ -84,8 +84,7 @@ static int aes_get_sizes(void)
tfm = crypto_alloc_skcipher(blkcipher_alg, 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(tfm)) {
- pr_err("encrypted_key: failed to alloc_cipher (%ld)\n",
- PTR_ERR(tfm));
+ pr_err("failed to alloc_cipher (%ld)\n", PTR_ERR(tfm));
return PTR_ERR(tfm);
}
ivsize = crypto_skcipher_ivsize(tfm);
@@ -106,15 +105,14 @@ static int valid_ecryptfs_desc(const char *ecryptfs_desc)
int i;
if (strlen(ecryptfs_desc) != KEY_ECRYPTFS_DESC_LEN) {
- pr_err("encrypted_key: key description must be %d hexadecimal "
- "characters long\n", KEY_ECRYPTFS_DESC_LEN);
+ pr_err("key description must be %d hexadecimal characters long\n",
+ KEY_ECRYPTFS_DESC_LEN);
return -EINVAL;
}
for (i = 0; i < KEY_ECRYPTFS_DESC_LEN; i++) {
if (!isxdigit(ecryptfs_desc[i])) {
- pr_err("encrypted_key: key description must contain "
- "only hexadecimal characters\n");
+ pr_err("key description must contain only hexadecimal characters\n");
return -EINVAL;
}
}
@@ -180,7 +178,7 @@ static int datablob_parse(char *datablob, const char **format,
keyword = strsep(&datablob, " \t");
if (!keyword) {
- pr_info("encrypted_key: insufficient parameters specified\n");
+ pr_info("insufficient parameters specified\n");
return ret;
}
key_cmd = match_token(keyword, key_tokens, args);
@@ -188,7 +186,7 @@ static int datablob_parse(char *datablob, const char **format,
/* Get optional format: default | ecryptfs */
p = strsep(&datablob, " \t");
if (!p) {
- pr_err("encrypted_key: insufficient parameters specified\n");
+ pr_err("insufficient parameters specified\n");
return ret;
}
@@ -205,20 +203,20 @@ static int datablob_parse(char *datablob, const char **format,
}
if (!*master_desc) {
- pr_info("encrypted_key: master key parameter is missing\n");
+ pr_info("master key parameter is missing\n");
goto out;
}
if (valid_master_desc(*master_desc, NULL) < 0) {
- pr_info("encrypted_key: master key parameter \'%s\' "
- "is invalid\n", *master_desc);
+ pr_info("master key parameter \'%s\' is invalid\n",
+ *master_desc);
goto out;
}
if (decrypted_datalen) {
*decrypted_datalen = strsep(&datablob, " \t");
if (!*decrypted_datalen) {
- pr_info("encrypted_key: keylen parameter is missing\n");
+ pr_info("keylen parameter is missing\n");
goto out;
}
}
@@ -226,37 +224,35 @@ static int datablob_parse(char *datablob, const char **format,
switch (key_cmd) {
case Opt_new:
if (!decrypted_datalen) {
- pr_info("encrypted_key: keyword \'%s\' not allowed "
- "when called from .update method\n", keyword);
+ pr_info("keyword \'%s\' not allowed when called from .update method\n",
+ keyword);
break;
}
ret = 0;
break;
case Opt_load:
if (!decrypted_datalen) {
- pr_info("encrypted_key: keyword \'%s\' not allowed "
- "when called from .update method\n", keyword);
+ pr_info("keyword \'%s\' not allowed when called from .update method\n",
+ keyword);
break;
}
*hex_encoded_iv = strsep(&datablob, " \t");
if (!*hex_encoded_iv) {
- pr_info("encrypted_key: hex blob is missing\n");
+ pr_info("hex blob is missing\n");
break;
}
ret = 0;
break;
case Opt_update:
if (decrypted_datalen) {
- pr_info("encrypted_key: keyword \'%s\' not allowed "
- "when called from .instantiate method\n",
+ pr_info("keyword \'%s\' not allowed when called from .instantiate method\n",
keyword);
break;
}
ret = 0;
break;
case Opt_err:
- pr_info("encrypted_key: keyword \'%s\' not recognized\n",
- keyword);
+ pr_info("keyword \'%s\' not recognized\n", keyword);
break;
}
out:
@@ -344,7 +340,7 @@ static int calc_hmac(u8 *digest, const u8 *key, unsigned int keylen,
tfm = crypto_alloc_shash(hmac_alg, 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(tfm)) {
- pr_err("encrypted_key: can't alloc %s transform: %ld\n",
+ pr_err("can't alloc %s transform: %ld\n",
hmac_alg, PTR_ERR(tfm));
return PTR_ERR(tfm);
}
@@ -395,22 +391,21 @@ static struct skcipher_request *init_skcipher_req(const u8 *key,
tfm = crypto_alloc_skcipher(blkcipher_alg, 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(tfm)) {
- pr_err("encrypted_key: failed to load %s transform (%ld)\n",
+ pr_err("failed to load %s transform (%ld)\n",
blkcipher_alg, PTR_ERR(tfm));
return ERR_CAST(tfm);
}
ret = crypto_skcipher_setkey(tfm, key, key_len);
if (ret < 0) {
- pr_err("encrypted_key: failed to setkey (%d)\n", ret);
+ pr_err("failed to setkey (%d)\n", ret);
crypto_free_skcipher(tfm);
return ERR_PTR(ret);
}
req = skcipher_request_alloc(tfm, GFP_KERNEL);
if (!req) {
- pr_err("encrypted_key: failed to allocate request for %s\n",
- blkcipher_alg);
+ pr_err("failed to allocate request for %s\n", blkcipher_alg);
crypto_free_skcipher(tfm);
return ERR_PTR(-ENOMEM);
}
@@ -441,11 +436,10 @@ static struct key *request_master_key(struct encrypted_key_payload *epayload,
int ret = PTR_ERR(mkey);
if (ret == -ENOTSUPP)
- pr_info("encrypted_key: key %s not supported",
+ pr_info("key %s not supported\n",
epayload->master_desc);
else
- pr_info("encrypted_key: key %s not found",
- epayload->master_desc);
+ pr_info("key %s not found\n", epayload->master_desc);
goto out;
}
@@ -490,7 +484,7 @@ static int derived_key_encrypt(struct encrypted_key_payload *epayload,
skcipher_request_free(req);
crypto_free_skcipher(tfm);
if (ret < 0)
- pr_err("encrypted_key: failed to encrypt (%d)\n", ret);
+ pr_err("failed to encrypt (%d)\n", ret);
else
dump_encrypted_data(epayload, encrypted_datalen);
out:
@@ -627,8 +621,7 @@ static struct encrypted_key_payload *encrypted_key_alloc(struct key *key,
payload_datalen = decrypted_datalen;
if (format && !strcmp(format, key_format_ecryptfs)) {
if (dlen != ECRYPTFS_MAX_KEY_BYTES) {
- pr_err("encrypted_key: keylen for the ecryptfs format "
- "must be equal to %d bytes\n",
+ pr_err("keylen for the ecryptfs format must be equal to %d bytes\n",
ECRYPTFS_MAX_KEY_BYTES);
return ERR_PTR(-EINVAL);
}
@@ -696,7 +689,7 @@ static int encrypted_key_decrypt(struct encrypted_key_payload *epayload,
ret = datablob_hmac_verify(epayload, format, master_key, master_keylen);
if (ret < 0) {
- pr_err("encrypted_key: bad hmac (%d)\n", ret);
+ pr_err("bad hmac (%d)\n", ret);
goto out;
}
@@ -706,7 +699,7 @@ static int encrypted_key_decrypt(struct encrypted_key_payload *epayload,
ret = derived_key_decrypt(epayload, derived_key, sizeof derived_key);
if (ret < 0)
- pr_err("encrypted_key: failed to decrypt key (%d)\n", ret);
+ pr_err("failed to decrypt key (%d)\n", ret);
out:
up_read(&mkey->sem);
key_put(mkey);
@@ -986,7 +979,7 @@ static int __init init_encrypted(void)
hash_tfm = crypto_alloc_shash(hash_alg, 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(hash_tfm)) {
- pr_err("encrypted_key: can't allocate %s transform: %ld\n",
+ pr_err("can't allocate %s transform: %ld\n",
hash_alg, PTR_ERR(hash_tfm));
return PTR_ERR(hash_tfm);
}
--
2.15.0
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread