81 |
continue; |
continue; |
82 |
} |
} |
83 |
if (is_dir) { |
if (is_dir) { |
84 |
is_dir = 0; *--end = '/'; buflen--; |
is_dir = false; *--end = '/'; buflen--; |
85 |
} |
} |
86 |
parent = dentry->d_parent; |
parent = dentry->d_parent; |
87 |
{ |
{ |
251 |
if (word_aligned_size > PAGE_SIZE) return NULL; |
if (word_aligned_size > PAGE_SIZE) return NULL; |
252 |
mutex_lock(&lock); |
mutex_lock(&lock); |
253 |
if (buf_used_len + word_aligned_size > PAGE_SIZE) { |
if (buf_used_len + word_aligned_size > PAGE_SIZE) { |
254 |
if ((ptr = kmalloc(PAGE_SIZE, GFP_KERNEL)) == NULL) { |
if ((ptr = kzalloc(PAGE_SIZE, GFP_KERNEL)) == NULL) { |
255 |
printk("ERROR: Out of memory for alloc_element().\n"); |
printk("ERROR: Out of memory for alloc_element().\n"); |
256 |
if (!sbin_init_started) panic("MAC Initialization failed.\n"); |
if (!sbin_init_started) panic("MAC Initialization failed.\n"); |
257 |
} else { |
} else { |
|
memset(ptr, 0, PAGE_SIZE); |
|
258 |
buf = ptr; |
buf = ptr; |
259 |
allocated_memory_for_elements += PAGE_SIZE; |
allocated_memory_for_elements += PAGE_SIZE; |
260 |
buf_used_len = word_aligned_size; |
buf_used_len = word_aligned_size; |
323 |
list_for_each_entry(fmb, &fmb_list, list) { |
list_for_each_entry(fmb, &fmb_list, list) { |
324 |
if (len <= fmb->len) goto ready; |
if (len <= fmb->len) goto ready; |
325 |
} |
} |
326 |
cp = kmalloc(PAGE_SIZE, GFP_KERNEL); |
cp = kzalloc(PAGE_SIZE, GFP_KERNEL); |
327 |
fmb = kmalloc(sizeof(*fmb), GFP_KERNEL); |
fmb = kzalloc(sizeof(*fmb), GFP_KERNEL); |
328 |
if (!cp || !fmb) { |
if (!cp || !fmb) { |
329 |
kfree(cp); |
kfree(cp); |
330 |
kfree(fmb); |
kfree(fmb); |
333 |
ptr = NULL; |
ptr = NULL; |
334 |
goto out; |
goto out; |
335 |
} |
} |
|
memset(cp, 0, PAGE_SIZE); |
|
336 |
allocated_memory_for_savename += PAGE_SIZE; |
allocated_memory_for_savename += PAGE_SIZE; |
337 |
list_add(&fmb->list, &fmb_list); |
list_add(&fmb->list, &fmb_list); |
338 |
fmb->ptr = cp; |
fmb->ptr = cp; |
412 |
|
|
413 |
void *ccs_alloc(const size_t size) |
void *ccs_alloc(const size_t size) |
414 |
{ |
{ |
415 |
void *ret = kmalloc(size, GFP_KERNEL); |
void *ret = kzalloc(size, GFP_KERNEL); |
416 |
if (ret) { |
if (ret) { |
417 |
struct cache_entry *new_entry = kmem_cache_alloc(ccs_cachep, GFP_KERNEL); |
struct cache_entry *new_entry = kmem_cache_alloc(ccs_cachep, GFP_KERNEL); |
418 |
if (!new_entry) { |
if (!new_entry) { |
429 |
list_add_tail(&new_entry->list, &cache_list); |
list_add_tail(&new_entry->list, &cache_list); |
430 |
dynamic_memory_size += new_entry->size; |
dynamic_memory_size += new_entry->size; |
431 |
spin_unlock(&cache_list_lock); |
spin_unlock(&cache_list_lock); |
|
memset(ret, 0, size); |
|
432 |
} |
} |
433 |
} |
} |
434 |
return ret; |
return ret; |