tools: ifdtool: Do not write region while its size is negative
authorBin Meng <bmeng.cn@gmail.com>
Sun, 31 May 2015 06:57:35 +0000 (14:57 +0800)
committerSimon Glass <sjg@chromium.org>
Thu, 4 Jun 2015 09:02:57 +0000 (03:02 -0600)
We should ignore those regions whose size is negative. These are
typically optional and unused regions (like GbE and platform data).

Change-Id: I65ad01746144604a1dc0588b617af21f2722ebbf
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
tools/ifdtool.c

index 590ccc914b064ec639b1dd79bc22b7ccd2a9edf7..1d61df19f231016f0eee82d275bf47c63e258215 100644 (file)
@@ -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 |