aboutsummaryrefslogtreecommitdiffstats
path: root/main/linux-grsec/gcc6.patch
blob: f2bc5adab264276850e28011c1e490396c6285d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
diff --git a/grsecurity/gracl.c b/grsecurity/gracl.c
index 7ad630a..3c66319 100644
--- a/grsecurity/gracl.c
+++ b/grsecurity/gracl.c
@@ -196,7 +196,7 @@ static int prepend(char **buffer, int *buflen, const char *str, int namelen)
 
 static int prepend_name(char **buffer, int *buflen, struct qstr *name)
 {
-	return prepend(buffer, buflen, name->name, name->len);
+	return prepend(buffer, buflen, (const char *)name->name, name->len);
 }
 
 static int prepend_path(const struct path *path, struct path *root,
@@ -560,7 +560,7 @@ struct name_entry *
 __lookup_name_entry(const struct gr_policy_state *state, const char *name)
 {
 	unsigned int len = strlen(name);
-	unsigned int key = full_name_hash(name, len);
+	unsigned int key = full_name_hash((const unsigned char *)name, len);
 	unsigned int index = key % state->name_set.n_size;
 	struct name_entry *match;
 
@@ -582,7 +582,7 @@ static struct name_entry *
 lookup_name_entry_create(const char *name)
 {
 	unsigned int len = strlen(name);
-	unsigned int key = full_name_hash(name, len);
+	unsigned int key = full_name_hash((const unsigned char *)name, len);
 	unsigned int index = key % running_polstate.name_set.n_size;
 	struct name_entry *match;
 
diff --git a/grsecurity/gracl_policy.c b/grsecurity/gracl_policy.c
index 0773423..bfcd64a 100644
--- a/grsecurity/gracl_policy.c
+++ b/grsecurity/gracl_policy.c
@@ -351,7 +351,7 @@ insert_name_entry(char *name, const u64 inode, const dev_t device, __u8 deleted)
 	struct name_entry **curr, *nentry;
 	struct inodev_entry *ientry;
 	unsigned int len = strlen(name);
-	unsigned int key = full_name_hash(name, len);
+	unsigned int key = full_name_hash((const unsigned char *)name, len);
 	unsigned int index = key % polstate->name_set.n_size;
 
 	curr = &polstate->name_set.n_hash[index];
@@ -1376,7 +1376,7 @@ lookup_special_role_auth(__u16 mode, const char *rolename, unsigned char **salt,
 	FOR_EACH_ROLE_END(r)
 
 	for (i = 0; i < polstate->num_sprole_pws; i++) {
-		if (!strcmp(rolename, polstate->acl_special_roles[i]->rolename)) {
+		if (!strcmp(rolename, (const char *)polstate->acl_special_roles[i]->rolename)) {
 			*salt = polstate->acl_special_roles[i]->salt;
 			*sum = polstate->acl_special_roles[i]->sum;
 			return 1;
@@ -1664,11 +1664,11 @@ write_grsec_handler(struct file *file, const char __user * buf, size_t count, lo
 		}
 
 		if (lookup_special_role_auth
-		    (gr_usermode->mode, gr_usermode->sp_role, &sprole_salt, &sprole_sum)
+		    (gr_usermode->mode, (const char *)gr_usermode->sp_role, &sprole_salt, &sprole_sum)
 		    && ((!sprole_salt && !sprole_sum)
 			|| !(chkpw(gr_usermode, sprole_salt, sprole_sum)))) {
 			char *p = "";
-			assign_special_role(gr_usermode->sp_role);
+			assign_special_role((const char *)gr_usermode->sp_role);
 			read_lock(&tasklist_lock);
 			if (current->real_parent)
 				p = current->real_parent->role->rolename;
diff --git a/grsecurity/grsum.c b/grsecurity/grsum.c
index 4fb2ce6..aef6b92 100644
--- a/grsecurity/grsum.c
+++ b/grsecurity/grsum.c
@@ -32,12 +32,12 @@ chkpw(struct gr_arg *entry, unsigned char *salt, unsigned char *sum)
 
 	sg_init_table(sg, 2);
 	sg_set_buf(&sg[0], salt, GR_SALT_LEN);
-	sg_set_buf(&sg[1], entry->pw, strlen(entry->pw));
+	sg_set_buf(&sg[1], entry->pw, strlen((const char *)entry->pw));
 
 	desc.tfm = tfm;
 	desc.flags = 0;
 
-	cryptres = crypto_hash_digest(&desc, sg, GR_SALT_LEN + strlen(entry->pw),
+	cryptres = crypto_hash_digest(&desc, sg, GR_SALT_LEN + strlen((const char *)entry->pw),
 					temp_sum);
 
 	memset(entry->pw, 0, GR_PW_LEN);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 25820d8..0491a0f 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2386,7 +2386,7 @@ extern void sched_clock_init(void);
 static inline void populate_stack(void)
 {
 	struct task_struct *curtask = current;
-	int c;
+	int __always_unused c;
 	int *ptr = curtask->stack;
 	int *end = curtask->stack + THREAD_SIZE;
 
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index a34ab2d..70fffac 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -517,7 +517,7 @@ static inline void sysfs_notify_dirent(struct kernfs_node *kn)
 static inline struct kernfs_node *sysfs_get_dirent(struct kernfs_node *parent,
 						   const unsigned char *name)
 {
-	return kernfs_find_and_get(parent, name);
+	return kernfs_find_and_get(parent, (const char *)name);
 }
 
 static inline struct kernfs_node *sysfs_get(struct kernfs_node *kn)