Browse Source

kernel: remove calls to calloc (they confuse the tracker)

K. Lange 2 years ago
parent
commit
662ad3b407
4 changed files with 10 additions and 5 deletions
  1. 2 1
      kernel/ds/bitset.c
  2. 2 1
      kernel/sys/module.c
  3. 2 1
      kernel/sys/process.c
  4. 4 2
      modules/ext2.c

+ 2 - 1
kernel/ds/bitset.c

@@ -17,7 +17,8 @@
 
 void bitset_init(bitset_t *set, size_t size) {
 	set->size = CEIL(size, 8);
-	set->data = calloc(set->size, 1);
+	set->data = malloc(set->size);
+	memset(set->data, 0, set->size);
 }
 
 void bitset_free(bitset_t *set) {

+ 2 - 1
kernel/sys/module.c

@@ -204,7 +204,8 @@ void * module_load_direct(void * blob, size_t length) {
 							 */
 							if (!set && table->st_shndx == 65522) {
 								if (!hashmap_get(symboltable, name)) {
-									void * final = calloc(1, table->st_value);
+									void * final = malloc(table->st_value);
+									memset(final, 0, table->st_value);
 									debug_print(NOTICE, "point %s to 0x%x", name, (uintptr_t)final);
 									hashmap_set(symboltable, name, (void *)final);
 									hashmap_set(local_symbols, name, (void *)final);

+ 2 - 1
kernel/sys/process.c

@@ -380,7 +380,8 @@ process_t * spawn_process(volatile process_t * parent, int reuse_fds) {
 
 	/* Allocate a new process */
 	debug_print(INFO,"   process_t {");
-	process_t * proc = calloc(sizeof(process_t),1);
+	process_t * proc = malloc(sizeof(process_t));
+	memset(proc, 0, sizeof(process_t));
 	debug_print(INFO,"   }");
 	proc->id = get_next_pid(); /* Set its PID */
 	proc->group = proc->id;    /* Set the GID */

+ 4 - 2
modules/ext2.c

@@ -827,7 +827,8 @@ static int mkdir_ext2(fs_node_t * parent, char * name, uint16_t permission) {
 	write_inode(this, inode, inode_no);
 
 	uint8_t * tmp = malloc(this->block_size);
-	ext2_dir_t * t = calloc(12,1);
+	ext2_dir_t * t = malloc(12);
+	memset(t, 0, 12);
 	t->inode = inode_no;
 	t->rec_len = 12;
 	t->name_len = 1;
@@ -1544,7 +1545,8 @@ static fs_node_t * mount_ext2(fs_node_t * block_device, int flags) {
 	if (!(this->flags & EXT2_FLAG_NOCACHE)) {
 		debug_print(INFO, "Allocating cache...");
 		DC = malloc(sizeof(ext2_disk_cache_entry_t) * this->cache_entries);
-		this->cache_data = calloc(this->block_size, this->cache_entries);
+		this->cache_data = malloc(this->block_size * this->cache_entries);
+		memset(this->cache_data, 0, this->block_size * this->cache_entries);
 		for (uint32_t i = 0; i < this->cache_entries; ++i) {
 			DC[i].block_no = 0;
 			DC[i].dirty = 0;