diff mbox

acpi: crsdump: fix large resource length calculation (LP: #1255793)

Message ID 1388752437-10941-1-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King Jan. 3, 2014, 12:33 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

fwts crsdump on large resource items is not taking into consideration
the upper 8 bits of the length field and also the 3 byte header to
calculate the size of the resource length. This means that the last
field or two are not being dumped.  This fix calculates the length
correctly.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpi/crsdump/crsdump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alex Hung Jan. 6, 2014, 7:10 a.m. UTC | #1
On 01/03/2014 08:33 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> fwts crsdump on large resource items is not taking into consideration
> the upper 8 bits of the length field and also the 3 byte header to
> calculate the size of the resource length. This means that the last
> field or two are not being dumped.  This fix calculates the length
> correctly.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/acpi/crsdump/crsdump.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/acpi/crsdump/crsdump.c b/src/acpi/crsdump/crsdump.c
> index 94fbf0c..334efa8 100644
> --- a/src/acpi/crsdump/crsdump.c
> +++ b/src/acpi/crsdump/crsdump.c
> @@ -497,7 +497,7 @@ static void crsdump_large_resource_items(
>   	const uint64_t length)
>   {
>   	uint8_t tag_item = data[0] & 0x7f;
> -	size_t crs_length = data[1];
> +	size_t crs_length = data[1] + (data[2] << 8) + 3;
>
>   	static const crsdump_info header[] = {
>   		CRS_BITS("Tag Type",		0, 128),
>

Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu Jan. 6, 2014, 7:28 a.m. UTC | #2
On 01/03/2014 08:33 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> fwts crsdump on large resource items is not taking into consideration
> the upper 8 bits of the length field and also the 3 byte header to
> calculate the size of the resource length. This means that the last
> field or two are not being dumped.  This fix calculates the length
> correctly.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/acpi/crsdump/crsdump.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/acpi/crsdump/crsdump.c b/src/acpi/crsdump/crsdump.c
> index 94fbf0c..334efa8 100644
> --- a/src/acpi/crsdump/crsdump.c
> +++ b/src/acpi/crsdump/crsdump.c
> @@ -497,7 +497,7 @@ static void crsdump_large_resource_items(
>   	const uint64_t length)
>   {
>   	uint8_t tag_item = data[0] & 0x7f;
> -	size_t crs_length = data[1];
> +	size_t crs_length = data[1] + (data[2] << 8) + 3;
>
>   	static const crsdump_info header[] = {
>   		CRS_BITS("Tag Type",		0, 128),
>

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

Patch

diff --git a/src/acpi/crsdump/crsdump.c b/src/acpi/crsdump/crsdump.c
index 94fbf0c..334efa8 100644
--- a/src/acpi/crsdump/crsdump.c
+++ b/src/acpi/crsdump/crsdump.c
@@ -497,7 +497,7 @@  static void crsdump_large_resource_items(
 	const uint64_t length)
 {
 	uint8_t tag_item = data[0] & 0x7f;
-	size_t crs_length = data[1];
+	size_t crs_length = data[1] + (data[2] << 8) + 3;
 
 	static const crsdump_info header[] = {
 		CRS_BITS("Tag Type",		0, 128),