[PATCH 2/3] lib: fwts_oops: fix fwts_oops_check dereference checks on oopses and warn_ons
Colin King
colin.king at canonical.com
Fri Nov 16 08:32:55 UTC 2012
From: Colin Ian King <colin.king at canonical.com>
fwts_oops_check() dereferences oopses and warn_ons before we check
if they are NULL. Fix this by checking if they are NULL before
assiging zero to them.
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
src/lib/src/fwts_oops.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/lib/src/fwts_oops.c b/src/lib/src/fwts_oops.c
index 4eaad1f..18a14ee 100644
--- a/src/lib/src/fwts_oops.c
+++ b/src/lib/src/fwts_oops.c
@@ -117,14 +117,15 @@ static void fwts_klog_stack_dump(
int fwts_oops_check(fwts_framework *fw, fwts_list *klog, int *oopses, int *warn_ons)
{
fwts_list_link *item;
- *oopses = 0;
- *warn_ons = 0;
/* Sanity check */
if ((fw == NULL) || (oopses == NULL) ||
(warn_ons == NULL) || (klog == NULL))
return FWTS_ERROR;
+ *oopses = 0;
+ *warn_ons = 0;
+
fwts_list_foreach(item, klog) {
char *line = fwts_klog_remove_timestamp(fwts_list_data(char *, item));
if ((strncmp("BUG:", line, 4) == 0) ||
--
1.7.10.4
More information about the fwts-devel
mailing list