summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Jauffres <michelx.jauffres@intel.com>2014-01-08 13:34:32 +0100
committerPatrick Tjin <pattjin@google.com>2014-07-21 20:22:40 -0700
commit978d75167a9d8f93641586f3969ce40a8d9177d7 (patch)
tree9808c32ad1fa0d38ca1349c07fe021af806468fc
parent9b26e971e13580caa2fc86bda13d9b1df06df741 (diff)
downloadbootstub-978d75167a9d8f93641586f3969ce40a8d9177d7.tar.gz
Fix klocwork critical in bootstub
BZ: 163012 Patch handles issue from klocwork build 87 using daily 20140106_2803 Issue number 87939: pointer bp checked for NULL at line 97 may be dereferenced at line 131. Change-Id: I01d53bfe28948167f7cc68f558cfb0c5639c7100 Signed-off-by: Michel Jauffres <michelx.jauffres@intel.com>
-rw-r--r--sfi.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sfi.c b/sfi.c
index 6636493..6d1d36b 100644
--- a/sfi.c
+++ b/sfi.c
@@ -47,8 +47,10 @@ int sfi_add_e820_entry(struct boot_params *bp, memory_map_t *mb_mmap, u64 start,
memory_map_t *mb_mmap_entry;
int i;
- /* ASSERT: bp != NULL */
- /* ASSERT: mb_mmap != NULL */
+ if (!bp || !mb_mmap) {
+ bs_printk("Bootstub: sfi_add_e820_entry failed\n");
+ return -1;
+ }
for (i=0; i < bp->e820_entries; i++) {
e820_entry = &(bp->e820_map[i]);
@@ -94,8 +96,12 @@ void sfi_setup_mmap(struct boot_params *bp, memory_map_t *mb_mmap)
unsigned long long start, end, size;
int i, num, type;
- if (bp)
- bp->e820_entries = 0;
+ if (!bp || !mb_mmap) {
+ bs_printk("Bootstub: sfi_setup_mmap failed\n");
+ return;
+ }
+
+ bp->e820_entries = 0;
/* search for sfi mmap table */
sb = (struct sfi_table *)sfi_search_mmap(SFI_BASE_ADDR, SFI_LENGTH);