public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCHv2] fdt_support: Fix buffer overflow in fdt_fixup_memory_banks
@ 2011-02-23 16:18 Kyle Moffett
  2011-03-06  4:09 ` Gerald Van Baren
  0 siblings, 1 reply; 3+ messages in thread
From: Kyle Moffett @ 2011-02-23 16:18 UTC (permalink / raw)
  To: u-boot

When fdt_fixup_memory_banks is called with 2-cell address and size
fields in the device-tree (IE: 64-bit address and size), then it will
overflow its on-stack "tmp" buffer.

This fixes the buffer size and adds a comment explaining how many bytes
need to be allocated per record.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
Cc: Jerry Van Baren <vanbaren@cideas.com>
---
Changelog:
  v2: Resubmitted separately from the other HWW-1U-1A changes.

 common/fdt_support.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/common/fdt_support.c b/common/fdt_support.c
index 6c98e5b..edcf04a 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -394,7 +394,7 @@ int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks)
 {
 	int err, nodeoffset;
 	int addr_cell_len, size_cell_len, len;
-	u8 tmp[banks * 8];
+	u8 tmp[banks * 16]; /* Up to 64-bit address + 64-bit size */
 	int bank;
 
 	err = fdt_check_header(blob);
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCHv2] fdt_support: Fix buffer overflow in fdt_fixup_memory_banks
  2011-02-23 16:18 [U-Boot] [PATCHv2] fdt_support: Fix buffer overflow in fdt_fixup_memory_banks Kyle Moffett
@ 2011-03-06  4:09 ` Gerald Van Baren
  2011-04-05 13:30   ` Jerry Van Baren
  0 siblings, 1 reply; 3+ messages in thread
From: Gerald Van Baren @ 2011-03-06  4:09 UTC (permalink / raw)
  To: u-boot

Dear Wolfgang,

Can you apply this patch for me?  Otherwise I'll apply it to my repo and 
send a pull request.

Acked-by: Gerald Van Baren <vanbaren@cideas.com>

Thanks,
gvb

On 02/23/2011 11:18 AM, Kyle Moffett wrote:
> When fdt_fixup_memory_banks is called with 2-cell address and size
> fields in the device-tree (IE: 64-bit address and size), then it will
> overflow its on-stack "tmp" buffer.
>
> This fixes the buffer size and adds a comment explaining how many bytes
> need to be allocated per record.
>
> Signed-off-by: Kyle Moffett<Kyle.D.Moffett@boeing.com>
> Cc: Jerry Van Baren<vanbaren@cideas.com>
> ---
> Changelog:
>    v2: Resubmitted separately from the other HWW-1U-1A changes.
>
>   common/fdt_support.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/common/fdt_support.c b/common/fdt_support.c
> index 6c98e5b..edcf04a 100644
> --- a/common/fdt_support.c
> +++ b/common/fdt_support.c
> @@ -394,7 +394,7 @@ int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks)
>   {
>   	int err, nodeoffset;
>   	int addr_cell_len, size_cell_len, len;
> -	u8 tmp[banks * 8];
> +	u8 tmp[banks * 16]; /* Up to 64-bit address + 64-bit size */
>   	int bank;
>
>   	err = fdt_check_header(blob);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCHv2] fdt_support: Fix buffer overflow in fdt_fixup_memory_banks
  2011-03-06  4:09 ` Gerald Van Baren
@ 2011-04-05 13:30   ` Jerry Van Baren
  0 siblings, 0 replies; 3+ messages in thread
From: Jerry Van Baren @ 2011-04-05 13:30 UTC (permalink / raw)
  To: u-boot

On 02/23/2011 11:18 AM, Kyle Moffett wrote:
> When fdt_fixup_memory_banks is called with 2-cell address and size
> fields in the device-tree (IE: 64-bit address and size), then it will
> overflow its on-stack "tmp" buffer.
>
> This fixes the buffer size and adds a comment explaining how many bytes
> need to be allocated per record.
>
> Signed-off-by: Kyle Moffett<Kyle.D.Moffett@boeing.com>
> Cc: Jerry Van Baren<vanbaren@cideas.com>
> ---
> Changelog:
>     v2: Resubmitted separately from the other HWW-1U-1A changes.

Applied to u-boot-fdt, thanks.

gvb

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-04-05 13:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-23 16:18 [U-Boot] [PATCHv2] fdt_support: Fix buffer overflow in fdt_fixup_memory_banks Kyle Moffett
2011-03-06  4:09 ` Gerald Van Baren
2011-04-05 13:30   ` Jerry Van Baren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox