acpi: s3: check for null pointer
diff mbox series

Message ID 20190610105721.16120-1-colin.king@canonical.com
State Accepted
Headers show
Series
  • acpi: s3: check for null pointer
Related show

Commit Message

Colin King June 10, 2019, 10:57 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The pointer 'klog_diff' can potentially be null, so check for this.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpi/s3/s3.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Alex Hung June 10, 2019, 8:29 p.m. UTC | #1
On 2019-06-10 3:57 a.m., Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The pointer 'klog_diff' can potentially be null, so check for this.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpi/s3/s3.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/acpi/s3/s3.c b/src/acpi/s3/s3.c
> index 79df1a6c..c754af81 100644
> --- a/src/acpi/s3/s3.c
> +++ b/src/acpi/s3/s3.c
> @@ -551,8 +551,9 @@ static int s3_test_multiple(fwts_framework *fw)
>  
>  		fwts_progress_message(fw, percent, "(Checking logs for errors)");
>  		klog_diff = fwts_klog_find_changes(klog_pre, klog_post);
> -		s3_check_log(fw, klog_diff, &klog_errors, &klog_oopses, &klog_warn_ons,
> -			&suspend_too_long, &resume_too_long);
> +		if (klog_diff)
> +			s3_check_log(fw, klog_diff, &klog_errors, &klog_oopses, &klog_warn_ons,
> +				&suspend_too_long, &resume_too_long);
>  
>  		fwts_klog_free(klog_pre);
>  		fwts_klog_free(klog_post);
> 


Acked-by: Alex Hung <alex.hung@canonical.com>
ivanhu June 11, 2019, 5:44 a.m. UTC | #2
On 6/10/19 6:57 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The pointer 'klog_diff' can potentially be null, so check for this.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpi/s3/s3.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/acpi/s3/s3.c b/src/acpi/s3/s3.c
> index 79df1a6c..c754af81 100644
> --- a/src/acpi/s3/s3.c
> +++ b/src/acpi/s3/s3.c
> @@ -551,8 +551,9 @@ static int s3_test_multiple(fwts_framework *fw)
>  
>  		fwts_progress_message(fw, percent, "(Checking logs for errors)");
>  		klog_diff = fwts_klog_find_changes(klog_pre, klog_post);
> -		s3_check_log(fw, klog_diff, &klog_errors, &klog_oopses, &klog_warn_ons,
> -			&suspend_too_long, &resume_too_long);
> +		if (klog_diff)
> +			s3_check_log(fw, klog_diff, &klog_errors, &klog_oopses, &klog_warn_ons,
> +				&suspend_too_long, &resume_too_long);
>  
>  		fwts_klog_free(klog_pre);
>  		fwts_klog_free(klog_post);


Acked-by: Ivan Hu <ivan.hu@canonical.com>

Patch
diff mbox series

diff --git a/src/acpi/s3/s3.c b/src/acpi/s3/s3.c
index 79df1a6c..c754af81 100644
--- a/src/acpi/s3/s3.c
+++ b/src/acpi/s3/s3.c
@@ -551,8 +551,9 @@  static int s3_test_multiple(fwts_framework *fw)
 
 		fwts_progress_message(fw, percent, "(Checking logs for errors)");
 		klog_diff = fwts_klog_find_changes(klog_pre, klog_post);
-		s3_check_log(fw, klog_diff, &klog_errors, &klog_oopses, &klog_warn_ons,
-			&suspend_too_long, &resume_too_long);
+		if (klog_diff)
+			s3_check_log(fw, klog_diff, &klog_errors, &klog_oopses, &klog_warn_ons,
+				&suspend_too_long, &resume_too_long);
 
 		fwts_klog_free(klog_pre);
 		fwts_klog_free(klog_post);