.. | .. |
---|
19 | 19 | /* Reduce error messages. */ |
---|
20 | 20 | static pid_t tomoyo_last_pid; |
---|
21 | 21 | const pid_t pid = current->pid; |
---|
| 22 | + |
---|
22 | 23 | if (tomoyo_last_pid != pid) { |
---|
23 | | - printk(KERN_WARNING "ERROR: Out of memory at %s.\n", |
---|
24 | | - function); |
---|
| 24 | + pr_warn("ERROR: Out of memory at %s.\n", function); |
---|
25 | 25 | tomoyo_last_pid = pid; |
---|
26 | 26 | } |
---|
27 | 27 | if (!tomoyo_policy_loaded) |
---|
.. | .. |
---|
48 | 48 | { |
---|
49 | 49 | if (ptr) { |
---|
50 | 50 | const size_t s = ksize(ptr); |
---|
| 51 | + |
---|
51 | 52 | tomoyo_memory_used[TOMOYO_MEMORY_POLICY] += s; |
---|
52 | 53 | if (!tomoyo_memory_quota[TOMOYO_MEMORY_POLICY] || |
---|
53 | 54 | tomoyo_memory_used[TOMOYO_MEMORY_POLICY] <= |
---|
.. | .. |
---|
73 | 74 | void *tomoyo_commit_ok(void *data, const unsigned int size) |
---|
74 | 75 | { |
---|
75 | 76 | void *ptr = kzalloc(size, GFP_NOFS); |
---|
| 77 | + |
---|
76 | 78 | if (tomoyo_memory_ok(ptr)) { |
---|
77 | 79 | memmove(ptr, data, size); |
---|
78 | 80 | memset(data, 0, size); |
---|
.. | .. |
---|
98 | 100 | struct list_head *list; |
---|
99 | 101 | const char *group_name = tomoyo_read_token(param); |
---|
100 | 102 | bool found = false; |
---|
| 103 | + |
---|
101 | 104 | if (!tomoyo_correct_word(group_name) || idx >= TOMOYO_MAX_GROUP) |
---|
102 | 105 | return NULL; |
---|
103 | 106 | e.group_name = tomoyo_get_name(group_name); |
---|
.. | .. |
---|
116 | 119 | } |
---|
117 | 120 | if (!found) { |
---|
118 | 121 | struct tomoyo_group *entry = tomoyo_commit_ok(&e, sizeof(e)); |
---|
| 122 | + |
---|
119 | 123 | if (entry) { |
---|
120 | 124 | INIT_LIST_HEAD(&entry->member_list); |
---|
121 | 125 | atomic_set(&entry->head.users, 1); |
---|
.. | .. |
---|
191 | 195 | void __init tomoyo_mm_init(void) |
---|
192 | 196 | { |
---|
193 | 197 | int idx; |
---|
| 198 | + |
---|
194 | 199 | for (idx = 0; idx < TOMOYO_MAX_HASH; idx++) |
---|
195 | 200 | INIT_LIST_HEAD(&tomoyo_name_list[idx]); |
---|
196 | 201 | tomoyo_kernel_namespace.name = "<kernel>"; |
---|