diff mbox

[U-Boot] tools: ifdtool: Do not write region while its size is negative

Message ID BLU436-SMTP32D1161F0599379D88D04CBFB70@phx.gbl
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Bin Meng May 31, 2015, 6:57 a.m. UTC
We should ignore those regions whose size is negative. These are
typically optional and unused regions (like GbE and platform data).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 tools/ifdtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Glass June 4, 2015, 9:03 a.m. UTC | #1
On 31 May 2015 at 00:57, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> We should ignore those regions whose size is negative. These are
> typically optional and unused regions (like GbE and platform data).
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  tools/ifdtool.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Simon Glass <sjg@chromium.org>
Simon Glass June 4, 2015, 3:15 p.m. UTC | #2
On 4 June 2015 at 03:03, Simon Glass <sjg@chromium.org> wrote:
> On 31 May 2015 at 00:57, Bin Meng <bmeng.cn@gmail.com> wrote:
>>
>> We should ignore those regions whose size is negative. These are
>> typically optional and unused regions (like GbE and platform data).
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>
>>  tools/ifdtool.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-x86, thanks!
diff mbox

Patch

diff --git a/tools/ifdtool.c b/tools/ifdtool.c
index 590ccc9..1d61df1 100644
--- a/tools/ifdtool.c
+++ b/tools/ifdtool.c
@@ -462,7 +462,7 @@  static int write_regions(char *image, int size)
 		if (ret)
 			return ret;
 		dump_region(i, frba);
-		if (region.size == 0)
+		if (region.size <= 0)
 			continue;
 		region_fd = open(region_filename(i),
 				 O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR |