[LIBS] Fixing CID 1201429: Dereference before null check (REVERSE_INULL)

/libs/common/buddy.c: 160 in buddy_alloc_find()
154     					   unsigned long *alloc_bin,
155     					   unsigned long *alloc_blk_count)
156     {
157     	irq_flags_t f;
158     	struct rb_node *n = ba->alloc.rb_node;
159
>>>     CID 1201429:  Dereference before null check  (REVERSE_INULL)
>>>     Null-checking "ba" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
160     	if (!ba) {
161     		return NULL;
162     	}
163
164     	DPRINTF("%s: ba=%p addr=0x%x\n", __func__, ba, addr);
165

Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
[EMULATORS] Fixing CID 1201431: Nesting level does not match indentation (NESTING_INDENT_MISMATCH)

/emulators/pci/pci_emu_core.c: 67 in pci_find_bus_by_id()
61     	vmm_mutex_lock(&controller->lock);
62
63     	list_for_each(l, &controller->attached_buses) {
64     		bus = list_entry(l, struct pci_bus, head);
65     		if (bus->bus_id == bus_id)
66     			vmm_mutex_unlock(&controller->lock);
>>>     CID 1201431:  Nesting level does not match indentation  (NESTING_INDENT_MISMATCH)
>>>     This  statement is indented to column 25, as if it were nested within the preceding parent statement, but it is not.
67     			return bus;
68     	}
69
70     	vmm_mutex_unlock(&controller->lock);
71
72     	return bus;

Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
[CORE] Fixing CID 1026112: Explicit null dereferenced (FORWARD_NULL)

/core/vmm_guest_aspace.c: 83 in vmm_guest_find_region()
77     	}
78
79     	/* Resolve aliased regions */
80     	while (reg->flags & VMM_REGION_ALIAS) {
81     		reg = NULL;
82     		found = FALSE;
>>>     CID 1026112:  Explicit null dereferenced  (FORWARD_NULL)
>>>     Dereferencing null pointer "reg".
83     		gphys_addr = reg->hphys_addr + (gphys_addr - reg->gphys_addr);
84     		vmm_read_lock_irqsave_lite(&aspace->reg_list_lock, flags);
85     		list_for_each(l, &aspace->reg_list) {
86     			reg = list_entry(l, struct vmm_region, head);
87     			if (((reg->flags & cmp_flags) == cmp_flags) &&
88     			    (reg->gphys_addr <= gphys_addr) &&

Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
[EMULATORS] Fixing CID 1201430: Out-of-bounds read (OVERRUN)

/emulators/pci/pci_emu_core.c: 459 in pci_emu_config_space_read()
453     				   __func__, reg_offs);
454     			vmm_spin_unlock_irqrestore(&class->lock,flags);
455     			return VMM_EINVALID;
456     		}
457     	}
458
>>>     CID 1201430:  Out-of-bounds read  (OVERRUN)
>>>     Overrunning array of 63 bytes at byte offset 63 by dereferencing pointer "(void const *)((u8 *)&class->conf_header + reg_offs)".
459     	memcpy(&ret, (const void *)(((u8 *)(&class->conf_header)) + reg_offs), size);
460
461     	vmm_spin_unlock_irqrestore(&class->lock, flags);
462
463     	return ret;
464     }

Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
Merge remote-tracking branch 'upstream/master' into A20