From 67ba4fba6a1213f4b0169bee21403ad02b761a2f Mon Sep 17 00:00:00 2001 From: stefan Date: Tue, 10 Aug 2010 20:15:23 +0000 Subject: [PATCH] - remove using of uninitialized local variables git-svn-id: http://svn.lfbs.rwth-aachen.de/svn/scc/trunk/MetalSVM@60 315a16e6-25f9-4109-90ae-ca3045a26c18 --- mm/memory.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 7168e8e9..1e352bf1 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -33,7 +33,7 @@ * 0 => free * 1 => occupied */ -static uint8_t bitmap[BITMAP_SIZE]; +static uint8_t bitmap[BITMAP_SIZE] = {[0 ... BITMAP_SIZE-1] = 0xFF}; static spinlock_t bitmap_lock = SPINLOCK_INIT; static size_t alloc_start; atomic_int32_t total_pages = ATOMIC_INIT(0); @@ -85,18 +85,20 @@ int mmu_init(void) size_t addr; /* set whole address space as occupied */ - memset(bitmap, 0xFF, sizeof(uint8_t)*BITMAP_SIZE); + // array is already initialized (see declaration) + //memset(bitmap, 0xFF, sizeof(uint8_t)*BITMAP_SIZE); #ifdef CONFIG_MULTIBOOT if (mb_info && (mb_info->flags & (1 << (6)))) { multiboot_memory_map_t* mmap = (multiboot_memory_map_t*) mb_info->mmap_addr; multiboot_memory_map_t* mmap_end = (void*) ((size_t) mb_info->mmap_addr + mb_info->mmap_length); + size_t end_addr; while (mmap < mmap_end) { if (mmap->type == MULTIBOOT_MEMORY_AVAILABLE) { /* set the available memory as "unused" */ - size_t end_addr = addr + mmap->len; - addr = mmap->addr; + addr = mmap->addr; + end_addr = addr + mmap->len; while (addr < end_addr) { page_clear_mark(addr / PAGE_SIZE);