Message ID | 1353054776-4856-3-git-send-email-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
On 11/16/2012 04:32 PM, Colin King wrote: > From: Colin Ian King <colin.king@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@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) || > Acked-by: Alex Hung <alex.hung@canonical.com>
On Fri, Nov 16, 2012 at 4:32 PM, Colin King <colin.king@canonical.com> wrote: > From: Colin Ian King <colin.king@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@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 > Acked-by: Keng-Yu Lin <kengyu@canonical.com>
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) ||