apparmor: constify policy name and hname
authorJohn Johansen <john.johansen@canonical.com>
Mon, 16 Jan 2017 08:42:30 +0000 (00:42 -0800)
committerJohn Johansen <john.johansen@canonical.com>
Mon, 16 Jan 2017 09:18:26 +0000 (01:18 -0800)
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/apparmorfs.c
security/apparmor/include/lib.h
security/apparmor/lib.c

index d7cfd79d9857b5f218bf99d3d3881574af5a51cf..96a02ee9c499b6b4134f6de9f24efac1fcadee2d 100644 (file)
@@ -38,7 +38,7 @@
  *
  * Returns: length of mangled name
  */
-static int mangle_name(char *name, char *target)
+static int mangle_name(const char *name, char *target)
 {
        char *t = target;
 
index b5c16d3a7a189dce5167ffd2a329d01e4ba9cb3c..7e81cdab4af0c25a130f54ac6b866dc84afb7132 100644 (file)
@@ -123,8 +123,8 @@ static inline bool path_mediated_fs(struct dentry *dentry)
  * @profiles: head of the profiles list contained in the object
  */
 struct aa_policy {
-       char *name;
-       char *hname;
+       const char *name;
+       const char *hname;
        struct list_head list;
        struct list_head profiles;
 };
index 02203889c3c812d7ee4969a1c8fc66fdc0ee0933..91d5766d1c287c5bb86a77813802a3744fc56c6f 100644 (file)
@@ -178,7 +178,7 @@ bool aa_policy_init(struct aa_policy *policy, const char *prefix,
                policy->hname = kmalloc(strlen(prefix) + strlen(name) + 3,
                                        GFP_KERNEL);
                if (policy->hname)
-                       sprintf(policy->hname, "%s//%s", prefix, name);
+                       sprintf((char *)policy->hname, "%s//%s", prefix, name);
        } else
                policy->hname = kstrdup(name, GFP_KERNEL);
        if (!policy->hname)