Lines Matching defs:ptr
39 * @ptr: Pointer to allocated memory.
43 * Returns true if @ptr is not NULL and quota not exceeded, false otherwise.
47 bool tomoyo_memory_ok(void *ptr)
49 if (ptr) {
50 const size_t s = ksize(ptr);
76 void *ptr = kzalloc(size, GFP_NOFS);
78 if (tomoyo_memory_ok(ptr)) {
79 memmove(ptr, data, size);
81 return ptr;
83 kfree(ptr);
154 struct tomoyo_name *ptr;
166 list_for_each_entry(ptr, head, head.list) {
167 if (hash != ptr->entry.hash || strcmp(name, ptr->entry.name) ||
168 atomic_read(&ptr->head.users) == TOMOYO_GC_IN_PROGRESS)
170 atomic_inc(&ptr->head.users);
173 ptr = kzalloc(sizeof(*ptr) + len, GFP_NOFS);
174 if (tomoyo_memory_ok(ptr)) {
175 ptr->entry.name = ((char *) ptr) + sizeof(*ptr);
176 memmove((char *) ptr->entry.name, name, len);
177 atomic_set(&ptr->head.users, 1);
178 tomoyo_fill_path_info(&ptr->entry);
179 list_add_tail(&ptr->head.list, head);
181 kfree(ptr);
182 ptr = NULL;
186 return ptr ? &ptr->entry : NULL;