static struct ima_rule_entry *ima_lsm_copy_rule(struct ima_rule_entry *entry)
 {
        struct ima_rule_entry *nentry;
-       int i, result;
+       int i;
 
        nentry = kmalloc(sizeof(*nentry), GFP_KERNEL);
        if (!nentry)
        memset(nentry->lsm, 0, FIELD_SIZEOF(struct ima_rule_entry, lsm));
 
        for (i = 0; i < MAX_LSM_RULES; i++) {
-               if (!entry->lsm[i].rule)
+               if (!entry->lsm[i].args_p)
                        continue;
 
                nentry->lsm[i].type = entry->lsm[i].type;
                if (!nentry->lsm[i].args_p)
                        goto out_err;
 
-               result = security_filter_rule_init(nentry->lsm[i].type,
-                                                  Audit_equal,
-                                                  nentry->lsm[i].args_p,
-                                                  &nentry->lsm[i].rule);
-               if (result == -EINVAL)
-                       pr_warn("ima: rule for LSM \'%d\' is undefined\n",
-                               entry->lsm[i].type);
+               security_filter_rule_init(nentry->lsm[i].type,
+                                         Audit_equal,
+                                         nentry->lsm[i].args_p,
+                                         &nentry->lsm[i].rule);
+               if (!nentry->lsm[i].rule)
+                       pr_warn("rule for LSM \'%s\' is undefined\n",
+                               (char *)entry->lsm[i].args_p);
        }
        return nentry;
 
        list_for_each_entry_safe(entry, e, &ima_policy_rules, list) {
                needs_update = 0;
                for (i = 0; i < MAX_LSM_RULES; i++) {
-                       if (entry->lsm[i].rule) {
+                       if (entry->lsm[i].args_p) {
                                needs_update = 1;
                                break;
                        }
 
                result = ima_lsm_update_rule(entry);
                if (result) {
-                       pr_err("ima: lsm rule update error %d\n",
-                               result);
+                       pr_err("lsm rule update error %d\n", result);
                        return;
                }
        }
 }
 
 /**
- * ima_match_rules - determine whether an inode matches the measure rule.
+ * ima_match_rules - determine whether an inode matches the policy rule.
  * @rule: a pointer to a rule
  * @inode: a pointer to an inode
  * @cred: a pointer to a credentials structure for user validation
                int rc = 0;
                u32 osid;
 
-               if (!rule->lsm[i].rule)
-                       continue;
-
+               if (!rule->lsm[i].rule) {
+                       if (!rule->lsm[i].args_p)
+                               continue;
+                       else
+                               return false;
+               }
                switch (i) {
                case LSM_OBJ_USER:
                case LSM_OBJ_ROLE:
                                           entry->lsm[lsm_rule].args_p,
                                           &entry->lsm[lsm_rule].rule);
        if (!entry->lsm[lsm_rule].rule) {
-               kfree(entry->lsm[lsm_rule].args_p);
-               return -EINVAL;
+               pr_warn("rule for LSM \'%s\' is undefined\n",
+                       (char *)entry->lsm[lsm_rule].args_p);
+
+               if (ima_rules == &ima_default_rules) {
+                       kfree(entry->lsm[lsm_rule].args_p);
+                       result = -EINVAL;
+               } else
+                       result = 0;
        }
 
        return result;