[PATCH] lib: fwts_memorymap: handle the case where str maybe NULL
Colin King
colin.king at canonical.com
Mon May 6 23:32:23 UTC 2013
From: Colin Ian King <colin.king at canonical.com>
Coverity CID #997294, Dereference after null check (FORWARD_NULL)
str may be null, in which case we should only parse for end
and register a memory map line if str is not NULL.
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
src/lib/src/fwts_memorymap.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/lib/src/fwts_memorymap.c b/src/lib/src/fwts_memorymap.c
index 6e8bc1e..e619627 100644
--- a/src/lib/src/fwts_memorymap.c
+++ b/src/lib/src/fwts_memorymap.c
@@ -185,11 +185,12 @@ static void fwts_memory_map_dmesg_info(void *data, void *private)
start = strtoull(str+10, NULL, 16);
str = strstr(line," - ");
- if (str)
+ if (str) {
str += 3;
- end = strtoull(str, NULL, 16) - 1;
+ end = strtoull(str, NULL, 16) - 1;
- fwts_register_memory_map_line(memory_map_list, start, end, fwts_memory_map_str_to_type(line));
+ fwts_register_memory_map_line(memory_map_list, start, end, fwts_memory_map_str_to_type(line));
+ }
}
}
--
1.8.1.2
More information about the fwts-devel
mailing list