Message ID | 1367883143-22146-1-git-send-email-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
On 05/07/2013 07:32 AM, Colin King wrote: > From: Colin Ian King <colin.king@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@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)); > + } > } > } > > Acked-by: Alex Hung <alex.hung@canonical.com>
On 05/07/2013 07:32 AM, Colin King wrote: > From: Colin Ian King <colin.king@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@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)); > + } > } > } > > Acked-by: Ivan Hu <ivan.hu@canonical.com>
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)); + } } }