ACK: [PATCH 2/3] lib: fwts_oops: fix fwts_oops_check dereference checks on oopses and warn_ons

Alex Hung alex.hung at canonical.com
Thu Nov 22 03:01:36 UTC 2012


On 11/16/2012 04:32 PM, Colin King wrote:
> 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) ||
>
Acked-by: Alex Hung <alex.hung at canonical.com>



More information about the fwts-devel mailing list