[U-Boot] Bug in cbfs

Simon Glass sjg at chromium.org
Thu Jun 30 21:53:22 CEST 2016


+Bin

Hi,

It's a good idea to cc people who have touched the code.

I believe the implementation is out of date, so may well be incorrect.
Please send a patch if you like.

Regards,
Simon

On 26 June 2016 at 22:35, Yaroslav K. <yar444 at gmail.com> wrote:
> Hello.
>
> Current implementation of cbfs prints incorrect file names. In the
> file fs/cbfs/cbfs.c
> there are lines
>
>                 swap_file_header(&header, fileHeader);
>                 if (header.offset < sizeof(const struct cbfs_cachenode *) ||
>                                 header.offset > header.len) {
>                         file_cbfs_result = CBFS_BAD_FILE;
>                         return -1;
>                 }
>                 newNode->next = NULL;
>                 newNode->type = header.type;
>                 newNode->data = start + header.offset;
>                 newNode->data_length = header.len;
>                 name_len = header.offset - sizeof(struct cbfs_cachenode *);
>                 newNode->name = (char *)fileHeader +
>                                 sizeof(struct cbfs_cachenode *);
>                 newNode->name_length = name_len;
>                 newNode->checksum = header.checksum;
>
> Shouldn't sizeof(const struct cbfs_cachenode *) and sizeof(struct
> cbfs_cachenode *)
> be replaced with sizeof(struct cbfs_fileheader)?
>
> --
> Yaroslav
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot


More information about the U-Boot mailing list