Patchwork wmi: Fix an error on processing the _WDG data

login
register
mail settings
Submitter Keng-Yu Lin
Date April 20, 2012, 8:05 a.m.
Message ID <1334909102-12784-1-git-send-email-kengyu@canonical.com>
Download mbox | patch
Permalink /patch/153956/
State Accepted
Headers show

Comments

Keng-Yu Lin - April 20, 2012, 8:05 a.m.
On processing the final element (the 8-th) of the raw _WDG data,
the pointer is not incremented. This causes the loss of the final
element and incorrect parsing result.

Signed-off-by: Keng-Yu Lin <kengyu@canonical.com>
---
 src/acpi/wmi/wmi.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Colin King - April 20, 2012, 8:16 a.m.
On 20/04/12 09:05, Keng-Yu Lin wrote:
> On processing the final element (the 8-th) of the raw _WDG data,
> the pointer is not incremented. This causes the loss of the final
> element and incorrect parsing result.
>
> Signed-off-by: Keng-Yu Lin<kengyu@canonical.com>
> ---
>   src/acpi/wmi/wmi.c |    5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/acpi/wmi/wmi.c b/src/acpi/wmi/wmi.c
> index de353c6..5a188eb 100644
> --- a/src/acpi/wmi/wmi.c
> +++ b/src/acpi/wmi/wmi.c
> @@ -219,7 +219,10 @@ static void wmi_get_wdg_data(fwts_framework *fw,
>   			str+=4;
>   			if (*str != ',') break;
>   			str++;
> -			if (!isspace(*str)) break;
> +			if (!isspace(*str)) {
> +				data++;
> +				break;
> +			}
>   			str++;
>   			data++;
>   			if (data>  wdg_data + size) {
Well spotted.  Thanks!

Acked-by: Colin Ian King <colin.king@canonical.com>
Alex Hung - April 20, 2012, 8:27 a.m.
On 04/20/2012 04:05 PM, Keng-Yu Lin wrote:
> On processing the final element (the 8-th) of the raw _WDG data,
> the pointer is not incremented. This causes the loss of the final
> element and incorrect parsing result.
>
> Signed-off-by: Keng-Yu Lin<kengyu@canonical.com>
> ---
>   src/acpi/wmi/wmi.c |    5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/acpi/wmi/wmi.c b/src/acpi/wmi/wmi.c
> index de353c6..5a188eb 100644
> --- a/src/acpi/wmi/wmi.c
> +++ b/src/acpi/wmi/wmi.c
> @@ -219,7 +219,10 @@ static void wmi_get_wdg_data(fwts_framework *fw,
>   			str+=4;
>   			if (*str != ',') break;
>   			str++;
> -			if (!isspace(*str)) break;
> +			if (!isspace(*str)) {
> +				data++;
> +				break;
> +			}
>   			str++;
>   			data++;
>   			if (data>  wdg_data + size) {

Acked-by: Alex Hung <alex.hung@canonical.com>

Patch

diff --git a/src/acpi/wmi/wmi.c b/src/acpi/wmi/wmi.c
index de353c6..5a188eb 100644
--- a/src/acpi/wmi/wmi.c
+++ b/src/acpi/wmi/wmi.c
@@ -219,7 +219,10 @@  static void wmi_get_wdg_data(fwts_framework *fw,
 			str+=4;
 			if (*str != ',') break;
 			str++;
-			if (!isspace(*str)) break;
+			if (!isspace(*str)) {
+				data++;
+				break;
+			}
 			str++;
 			data++;
 			if (data > wdg_data + size) {