* [U-Boot] [PATCH] fdt_resize(): ensure minimum padding
@ 2008-10-27 21:47 Peter Korsgaard
2008-10-27 22:20 ` Jerry Van Baren
0 siblings, 1 reply; 5+ messages in thread
From: Peter Korsgaard @ 2008-10-27 21:47 UTC (permalink / raw)
To: u-boot
fdt_add_mem_rsv() requires space for a struct fdt_reserve_entry
(16 bytes), so make sure that fdt_resize atleast adds that much
padding, no matter what the location or size of the fdt is.
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
---
common/fdt_support.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 8ceeb0f..e2197ed 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -575,9 +575,10 @@ int fdt_resize(void *blob)
}
}
- /* Calculate the actual size of the fdt */
+ /* Calculate the actual size of the fdt
+ + size needed for fdt_add_mem_rsv */
actualsize = fdt_off_dt_strings(blob) +
- fdt_size_dt_strings(blob);
+ fdt_size_dt_strings(blob) + sizeof(struct fdt_reserve_entry);
/* Make it so the fdt ends on a page boundary */
actualsize = ALIGN(actualsize, 0x1000);
--
1.5.6.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] fdt_resize(): ensure minimum padding
2008-10-27 21:47 [U-Boot] [PATCH] fdt_resize(): ensure minimum padding Peter Korsgaard
@ 2008-10-27 22:20 ` Jerry Van Baren
2008-10-28 7:26 ` Peter Korsgaard
0 siblings, 1 reply; 5+ messages in thread
From: Jerry Van Baren @ 2008-10-27 22:20 UTC (permalink / raw)
To: u-boot
Peter Korsgaard wrote:
> fdt_add_mem_rsv() requires space for a struct fdt_reserve_entry
> (16 bytes), so make sure that fdt_resize atleast adds that much
s/atleast/at least/
> padding, no matter what the location or size of the fdt is.
>
> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
> ---
> common/fdt_support.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/common/fdt_support.c b/common/fdt_support.c
> index 8ceeb0f..e2197ed 100644
> --- a/common/fdt_support.c
> +++ b/common/fdt_support.c
> @@ -575,9 +575,10 @@ int fdt_resize(void *blob)
> }
> }
>
> - /* Calculate the actual size of the fdt */
> + /* Calculate the actual size of the fdt
> + + size needed for fdt_add_mem_rsv */
Please use coding standard multiline comments:
/*
* Calculate the actual size of the fdt
* plus the size needed for fdt_add_mem_rsv
*/
> actualsize = fdt_off_dt_strings(blob) +
> - fdt_size_dt_strings(blob);
> + fdt_size_dt_strings(blob) + sizeof(struct fdt_reserve_entry);
>
> /* Make it so the fdt ends on a page boundary */
> actualsize = ALIGN(actualsize, 0x1000);
Thanks,
gvb
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] fdt_resize(): ensure minimum padding
2008-10-27 22:20 ` Jerry Van Baren
@ 2008-10-28 7:26 ` Peter Korsgaard
0 siblings, 0 replies; 5+ messages in thread
From: Peter Korsgaard @ 2008-10-28 7:26 UTC (permalink / raw)
To: u-boot
>>>>> "Jerry" == Jerry Van Baren <gvb.uboot@gmail.com> writes:
Hi,
Jerry> Please use coding standard multiline comments:
Jerry> /*
Jerry> * Calculate the actual size of the fdt
Jerry> * plus the size needed for fdt_add_mem_rsv
Jerry> */
Thanks, will fix and respin.
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] fdt_resize(): ensure minimum padding
@ 2008-10-28 7:26 Peter Korsgaard
2008-10-29 0:26 ` Jerry Van Baren
0 siblings, 1 reply; 5+ messages in thread
From: Peter Korsgaard @ 2008-10-28 7:26 UTC (permalink / raw)
To: u-boot
fdt_add_mem_rsv() requires space for a struct fdt_reserve_entry
(16 bytes), so make sure that fdt_resize at least adds that much
padding, no matter what the location or size of the fdt is.
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Acked-by: Andy Fleming <afleming@freescale.com>
---
common/fdt_support.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 8ceeb0f..138334e 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -575,9 +575,12 @@ int fdt_resize(void *blob)
}
}
- /* Calculate the actual size of the fdt */
+ /*
+ * Calculate the actual size of the fdt
+ * plus the size needed for fdt_add_mem_rsv
+ */
actualsize = fdt_off_dt_strings(blob) +
- fdt_size_dt_strings(blob);
+ fdt_size_dt_strings(blob) + sizeof(struct fdt_reserve_entry);
/* Make it so the fdt ends on a page boundary */
actualsize = ALIGN(actualsize, 0x1000);
--
1.5.6.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] fdt_resize(): ensure minimum padding
2008-10-28 7:26 Peter Korsgaard
@ 2008-10-29 0:26 ` Jerry Van Baren
0 siblings, 0 replies; 5+ messages in thread
From: Jerry Van Baren @ 2008-10-29 0:26 UTC (permalink / raw)
To: u-boot
Peter Korsgaard wrote:
> fdt_add_mem_rsv() requires space for a struct fdt_reserve_entry
> (16 bytes), so make sure that fdt_resize at least adds that much
> padding, no matter what the location or size of the fdt is.
>
> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
> Acked-by: Andy Fleming <afleming@freescale.com>
> ---
> common/fdt_support.c | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/common/fdt_support.c b/common/fdt_support.c
> index 8ceeb0f..138334e 100644
> --- a/common/fdt_support.c
> +++ b/common/fdt_support.c
> @@ -575,9 +575,12 @@ int fdt_resize(void *blob)
> }
> }
>
> - /* Calculate the actual size of the fdt */
> + /*
> + * Calculate the actual size of the fdt
> + * plus the size needed for fdt_add_mem_rsv
> + */
> actualsize = fdt_off_dt_strings(blob) +
> - fdt_size_dt_strings(blob);
> + fdt_size_dt_strings(blob) + sizeof(struct fdt_reserve_entry);
>
> /* Make it so the fdt ends on a page boundary */
> actualsize = ALIGN(actualsize, 0x1000);
Applied to the u-boot-fdt subrepo.
Thanks,
gvb
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-10-29 0:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-27 21:47 [U-Boot] [PATCH] fdt_resize(): ensure minimum padding Peter Korsgaard
2008-10-27 22:20 ` Jerry Van Baren
2008-10-28 7:26 ` Peter Korsgaard
-- strict thread matches above, loose matches on Subject: below --
2008-10-28 7:26 Peter Korsgaard
2008-10-29 0:26 ` 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