[coreboot] ifwitool: Incorrect calculation of dst_size

Rolf Evers-Fischer embedded24 at evers-fischer.de
Mon Jun 13 13:10:56 CEST 2016


Dear Furquan,
it seems to me that there is a slight formal mistake in calculation of 
dst_size, which causes the ifwitool to crash.

I was able to fix it on my own with the following patch, which moves the 
closing bracket one line ahead:

diff --git a/util/cbfstool/ifwitool.c b/util/cbfstool/ifwitool.c
index 7fca542..a1365bd 100644
--- a/util/cbfstool/ifwitool.c
+++ b/util/cbfstool/ifwitool.c
@@ -1679,8 +1679,8 @@ static enum ifwi_ret ifwi_dir_replace(int type)
        }
 
        struct buffer dst;
-       size_t dst_size = buffer_size(&ifwi_image.subpart_buf[type] +
-                                     buffer_size(&b) - s->e[i].length);
+       size_t dst_size = buffer_size(&ifwi_image.subpart_buf[type]) +
+                                     buffer_size(&b) - s->e[i].length;
        size_t subpart_start = s->e[i].offset;
        size_t subpart_end = s->e[i].offset + s->e[i].length;
 

Could you please confirm if this correction is okay?

Best regards,
 Rolf



More information about the coreboot mailing list