提交 52a13284 编写于 作者: M Mimi Zohar

ima: use static const char array definitions

A const char pointer allocates memory for a pointer as well as for
a string,  This patch replaces a number of the const char pointers
throughout IMA, with a static const char array.
Suggested-by: NDavid Howells <dhowells@redhat.com>
Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
Acked-by: NDavid Howells <dhowells@redhat.com>
上级 31d4b761
...@@ -92,8 +92,8 @@ int ima_store_template(struct ima_template_entry *entry, ...@@ -92,8 +92,8 @@ int ima_store_template(struct ima_template_entry *entry,
int violation, struct inode *inode, int violation, struct inode *inode,
const unsigned char *filename) const unsigned char *filename)
{ {
const char *op = "add_template_measure"; static const char op[] = "add_template_measure";
const char *audit_cause = "hashing_error"; static const char audit_cause[] = "hashing_error";
char *template_name = entry->template_desc->name; char *template_name = entry->template_desc->name;
int result; int result;
struct { struct {
...@@ -260,8 +260,8 @@ void ima_store_measurement(struct integrity_iint_cache *iint, ...@@ -260,8 +260,8 @@ void ima_store_measurement(struct integrity_iint_cache *iint,
struct evm_ima_xattr_data *xattr_value, struct evm_ima_xattr_data *xattr_value,
int xattr_len) int xattr_len)
{ {
const char *op = "add_template_measure"; static const char op[] = "add_template_measure";
const char *audit_cause = "ENOMEM"; static const char audit_cause[] = "ENOMEM";
int result = -ENOMEM; int result = -ENOMEM;
struct inode *inode = file_inode(file); struct inode *inode = file_inode(file);
struct ima_template_entry *entry; struct ima_template_entry *entry;
......
...@@ -177,11 +177,11 @@ int ima_appraise_measurement(int func, struct integrity_iint_cache *iint, ...@@ -177,11 +177,11 @@ int ima_appraise_measurement(int func, struct integrity_iint_cache *iint,
struct evm_ima_xattr_data *xattr_value, struct evm_ima_xattr_data *xattr_value,
int xattr_len) int xattr_len)
{ {
static const char op[] = "appraise_data";
char *cause = "unknown";
struct dentry *dentry = file->f_dentry; struct dentry *dentry = file->f_dentry;
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
enum integrity_status status = INTEGRITY_UNKNOWN; enum integrity_status status = INTEGRITY_UNKNOWN;
const char *op = "appraise_data";
char *cause = "unknown";
int rc = xattr_len, hash_start = 0; int rc = xattr_len, hash_start = 0;
if (!ima_appraise) if (!ima_appraise)
......
...@@ -42,10 +42,10 @@ int ima_used_chip; ...@@ -42,10 +42,10 @@ int ima_used_chip;
*/ */
static void __init ima_add_boot_aggregate(void) static void __init ima_add_boot_aggregate(void)
{ {
static const char op[] = "add_boot_aggregate";
const char *audit_cause = "ENOMEM";
struct ima_template_entry *entry; struct ima_template_entry *entry;
struct integrity_iint_cache tmp_iint, *iint = &tmp_iint; struct integrity_iint_cache tmp_iint, *iint = &tmp_iint;
const char *op = "add_boot_aggregate";
const char *audit_cause = "ENOMEM";
int result = -ENOMEM; int result = -ENOMEM;
int violation = 0; int violation = 0;
struct { struct {
......
...@@ -329,7 +329,7 @@ void __init ima_init_policy(void) ...@@ -329,7 +329,7 @@ void __init ima_init_policy(void)
*/ */
void ima_update_policy(void) void ima_update_policy(void)
{ {
const char *op = "policy_update"; static const char op[] = "policy_update";
const char *cause = "already exists"; const char *cause = "already exists";
int result = 1; int result = 1;
int audit_info = 0; int audit_info = 0;
...@@ -645,7 +645,7 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) ...@@ -645,7 +645,7 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
*/ */
ssize_t ima_parse_add_rule(char *rule) ssize_t ima_parse_add_rule(char *rule)
{ {
const char *op = "update_policy"; static const char op[] = "update_policy";
char *p; char *p;
struct ima_rule_entry *entry; struct ima_rule_entry *entry;
ssize_t result, len; ssize_t result, len;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册