Patchwork bios: mpdump: fix indexing outside of mpdump_sys_addr_type array

login
register
mail settings
Submitter Colin King
Date June 16, 2013, 6:18 a.m.
Message ID <1371363483-10964-1-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/251659/
State Accepted
Headers show

Comments

Colin King - June 16, 2013, 6:18 a.m.
From: Colin Ian King <colin.king@canonical.com>

mpdump_sys_addr_type has 3 elements, so fix the guard check which
was off by 1.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/bios/multiproc/mpdump.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Alex Hung - June 17, 2013, 3:02 a.m.
On 06/16/2013 02:18 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> mpdump_sys_addr_type has 3 elements, so fix the guard check which
> was off by 1.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/bios/multiproc/mpdump.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/bios/multiproc/mpdump.c b/src/bios/multiproc/mpdump.c
> index ac6c684..fd2d7a3 100644
> --- a/src/bios/multiproc/mpdump.c
> +++ b/src/bios/multiproc/mpdump.c
> @@ -181,7 +181,7 @@ static void mpdump_dump_sys_addr_entry(fwts_framework *fw, void *data, uint32_t
>   	fwts_log_info_verbatum(fw, "System Address Space Mapping Entry: (@0x%8.8x)", phys_addr);
>   	fwts_log_info_verbatum(fw, "  Bus ID:             0x%2.2x", sys_addr_entry->bus_id);
>   	fwts_log_info_verbatum(fw, "  Address Type:       0x%2.2x (%s)", sys_addr_entry->address_type,
> -			sys_addr_entry->address_type < 4 ? mpdump_sys_addr_type[sys_addr_entry->address_type] : "Unknown");
> +			sys_addr_entry->address_type < 3 ? mpdump_sys_addr_type[sys_addr_entry->address_type] : "Unknown");
>   	fwts_log_info_verbatum(fw, "  Address Start:      0x%16.16llx",
>   		(unsigned long long)sys_addr_entry->address_base);
>   	fwts_log_info_verbatum(fw, "  Address End:        0x%16.16llx",
> @@ -457,7 +457,7 @@ static void mpdump_dump_system_address_table(fwts_framework *fw)
>   			(unsigned long long)sys_addr_entry->address_base +
>   			sys_addr_entry->address_length,
>   			sys_addr_entry->bus_id,
> -			sys_addr_entry->address_type < 4 ?
> +			sys_addr_entry->address_type < 3 ?
>   				mpdump_sys_addr_type[sys_addr_entry->address_type] : "Unknown");
>   	}
>
>

Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu - June 20, 2013, 7:46 a.m.
On 06/16/2013 02:18 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> mpdump_sys_addr_type has 3 elements, so fix the guard check which
> was off by 1.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/bios/multiproc/mpdump.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/bios/multiproc/mpdump.c b/src/bios/multiproc/mpdump.c
> index ac6c684..fd2d7a3 100644
> --- a/src/bios/multiproc/mpdump.c
> +++ b/src/bios/multiproc/mpdump.c
> @@ -181,7 +181,7 @@ static void mpdump_dump_sys_addr_entry(fwts_framework *fw, void *data, uint32_t
>   	fwts_log_info_verbatum(fw, "System Address Space Mapping Entry: (@0x%8.8x)", phys_addr);
>   	fwts_log_info_verbatum(fw, "  Bus ID:             0x%2.2x", sys_addr_entry->bus_id);
>   	fwts_log_info_verbatum(fw, "  Address Type:       0x%2.2x (%s)", sys_addr_entry->address_type,
> -			sys_addr_entry->address_type < 4 ? mpdump_sys_addr_type[sys_addr_entry->address_type] : "Unknown");
> +			sys_addr_entry->address_type < 3 ? mpdump_sys_addr_type[sys_addr_entry->address_type] : "Unknown");
>   	fwts_log_info_verbatum(fw, "  Address Start:      0x%16.16llx",
>   		(unsigned long long)sys_addr_entry->address_base);
>   	fwts_log_info_verbatum(fw, "  Address End:        0x%16.16llx",
> @@ -457,7 +457,7 @@ static void mpdump_dump_system_address_table(fwts_framework *fw)
>   			(unsigned long long)sys_addr_entry->address_base +
>   			sys_addr_entry->address_length,
>   			sys_addr_entry->bus_id,
> -			sys_addr_entry->address_type < 4 ?
> +			sys_addr_entry->address_type < 3 ?
>   				mpdump_sys_addr_type[sys_addr_entry->address_type] : "Unknown");
>   	}
>
>

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

Patch

diff --git a/src/bios/multiproc/mpdump.c b/src/bios/multiproc/mpdump.c
index ac6c684..fd2d7a3 100644
--- a/src/bios/multiproc/mpdump.c
+++ b/src/bios/multiproc/mpdump.c
@@ -181,7 +181,7 @@  static void mpdump_dump_sys_addr_entry(fwts_framework *fw, void *data, uint32_t
 	fwts_log_info_verbatum(fw, "System Address Space Mapping Entry: (@0x%8.8x)", phys_addr);
 	fwts_log_info_verbatum(fw, "  Bus ID:             0x%2.2x", sys_addr_entry->bus_id);
 	fwts_log_info_verbatum(fw, "  Address Type:       0x%2.2x (%s)", sys_addr_entry->address_type,
-			sys_addr_entry->address_type < 4 ? mpdump_sys_addr_type[sys_addr_entry->address_type] : "Unknown");
+			sys_addr_entry->address_type < 3 ? mpdump_sys_addr_type[sys_addr_entry->address_type] : "Unknown");
 	fwts_log_info_verbatum(fw, "  Address Start:      0x%16.16llx", 
 		(unsigned long long)sys_addr_entry->address_base);
 	fwts_log_info_verbatum(fw, "  Address End:        0x%16.16llx",
@@ -457,7 +457,7 @@  static void mpdump_dump_system_address_table(fwts_framework *fw)
 			(unsigned long long)sys_addr_entry->address_base +
 			sys_addr_entry->address_length,
 			sys_addr_entry->bus_id,
-			sys_addr_entry->address_type < 4 ? 
+			sys_addr_entry->address_type < 3 ? 
 				mpdump_sys_addr_type[sys_addr_entry->address_type] : "Unknown");
 	}