소스 검색

apparmor: constify policy name and hname

Signed-off-by: John Johansen <john.johansen@canonical.com>
John Johansen 9 년 전
부모
커밋
bbe4a7c873
3개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  1. 1 1
      security/apparmor/apparmorfs.c
  2. 2 2
      security/apparmor/include/lib.h
  3. 1 1
      security/apparmor/lib.c

+ 1 - 1
security/apparmor/apparmorfs.c

@@ -38,7 +38,7 @@
  *
  *
  * Returns: length of mangled name
  * 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;
 	char *t = target;
 
 

+ 2 - 2
security/apparmor/include/lib.h

@@ -123,8 +123,8 @@ static inline bool path_mediated_fs(struct dentry *dentry)
  * @profiles: head of the profiles list contained in the object
  * @profiles: head of the profiles list contained in the object
  */
  */
 struct aa_policy {
 struct aa_policy {
-	char *name;
-	char *hname;
+	const char *name;
+	const char *hname;
 	struct list_head list;
 	struct list_head list;
 	struct list_head profiles;
 	struct list_head profiles;
 };
 };

+ 1 - 1
security/apparmor/lib.c

@@ -178,7 +178,7 @@ bool aa_policy_init(struct aa_policy *policy, const char *prefix,
 		policy->hname = kmalloc(strlen(prefix) + strlen(name) + 3,
 		policy->hname = kmalloc(strlen(prefix) + strlen(name) + 3,
 					GFP_KERNEL);
 					GFP_KERNEL);
 		if (policy->hname)
 		if (policy->hname)
-			sprintf(policy->hname, "%s//%s", prefix, name);
+			sprintf((char *)policy->hname, "%s//%s", prefix, name);
 	} else
 	} else
 		policy->hname = kstrdup(name, GFP_KERNEL);
 		policy->hname = kstrdup(name, GFP_KERNEL);
 	if (!policy->hname)
 	if (!policy->hname)