[coreboot] ifwitool: Incorrect calculation of dst_size

Furquan Shaikh furquan at google.com
Mon Jun 13 13:28:58 CEST 2016


Hello Rolf,

Thanks for the fix! Yes, the correction looks good. Please feel free to
push this change to gerrit on coreboot.org.

- Furquan

On Mon, Jun 13, 2016 at 4:10 AM, Rolf Evers-Fischer <
embedded24 at evers-fischer.de> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20160613/a6eb7343/attachment.html>


More information about the coreboot mailing list