diff mbox

[U-Boot] Bug in cbfs

Message ID CAOf8ET-K9Yf75L1D6NxLibRg0XHjrsyS4XecuQcc9NEJ3g0MEA@mail.gmail.com
State Superseded
Delegated to: Bin Meng
Headers show

Commit Message

Yaroslav K. July 22, 2016, 10:21 a.m. UTC
cbfs: Fix incorrect CBFS file header size being used

This fixes incorrect filenames in cbfsls output.

Signed-off-by: Yaroslav K. <yar444@gmail.com>
---
 fs/cbfs/cbfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Simon Glass July 23, 2016, 2:57 a.m. UTC | #1
On 22 July 2016 at 04:21, Yaroslav K. <yar444@gmail.com> wrote:
> cbfs: Fix incorrect CBFS file header size being used
>
> This fixes incorrect filenames in cbfsls output.
>
> Signed-off-by: Yaroslav K. <yar444@gmail.com>
> ---
>  fs/cbfs/cbfs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Bin Meng Aug. 6, 2016, 12:06 a.m. UTC | #2
Hi Yaroslav,

On Fri, Jul 22, 2016 at 6:21 PM, Yaroslav K. <yar444@gmail.com> wrote:
> cbfs: Fix incorrect CBFS file header size being used

Please make this the email title of this patch.

>
> This fixes incorrect filenames in cbfsls output.
>
> Signed-off-by: Yaroslav K. <yar444@gmail.com>
> ---
>  fs/cbfs/cbfs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/cbfs/cbfs.c b/fs/cbfs/cbfs.c
> index 95a48a4..bfe8e2c 100644
> --- a/fs/cbfs/cbfs.c
> +++ b/fs/cbfs/cbfs.c
> @@ -97,7 +97,7 @@ static int file_cbfs_next_file(u8 *start, u32 size, u32 align,
>                 }
>
>                 swap_file_header(&header, fileHeader);
> -               if (header.offset < sizeof(const struct cbfs_cachenode *) ||
> +               if (header.offset < sizeof(struct cbfs_fileheader) ||
>                                 header.offset > header.len) {
>                         file_cbfs_result = CBFS_BAD_FILE;
>                         return -1;
> @@ -106,9 +106,9 @@ static int file_cbfs_next_file(u8 *start, u32
> size, u32 align,
>                 newNode->type = header.type;
>                 newNode->data = start + header.offset;
>                 newNode->data_length = header.len;
> -               name_len = header.offset - sizeof(struct cbfs_cachenode *);
> +               name_len = header.offset - sizeof(struct cbfs_fileheader);
>                 newNode->name = (char *)fileHeader +
> -                               sizeof(struct cbfs_cachenode *);
> +                               sizeof(struct cbfs_fileheader);
>                 newNode->name_length = name_len;
>                 newNode->checksum = header.checksum;
>
> --

There are lots of style issues. Please fix this.

ERROR: code indent should use tabs where possible
#32: FILE: fs/cbfs/cbfs.c:100:
+               if (header.offset < sizeof(struct cbfs_fileheader) ||$

WARNING: please, no spaces at the start of a line
#32: FILE: fs/cbfs/cbfs.c:100:
+               if (header.offset < sizeof(struct cbfs_fileheader) ||$

WARNING: suspect code indent for conditional statements (15, 23)
#32: FILE: fs/cbfs/cbfs.c:100:
+               if (header.offset < sizeof(struct cbfs_fileheader) ||
[...]
                        file_cbfs_result = CBFS_BAD_FILE;

ERROR: patch seems to be corrupt (line wrapped?)
#37: FILE: fs/cbfs/cbfs.c:105:
size, u32 align,

ERROR: code indent should use tabs where possible
#42: FILE: fs/cbfs/cbfs.c:109:
+               name_len = header.offset - sizeof(struct cbfs_fileheader);$

WARNING: please, no spaces at the start of a line
#42: FILE: fs/cbfs/cbfs.c:109:
+               name_len = header.offset - sizeof(struct cbfs_fileheader);$

ERROR: code indent should use tabs where possible
#45: FILE: fs/cbfs/cbfs.c:111:
+                               sizeof(struct cbfs_fileheader);$

WARNING: please, no spaces at the start of a line
#45: FILE: fs/cbfs/cbfs.c:111:
+                               sizeof(struct cbfs_fileheader);$

total: 4 errors, 4 warnings, 0 checks, 19 lines checked

NOTE: whitespace errors detected, you may wish to use scripts/cleanpatch or
      scripts/cleanfile

NOTE: Ignored message types: COMPLEX_MACRO CONSIDER_KSTRTO MINMAX
MULTISTATEMENT_MACRO_USE_DO_WHILE NETWORKING_BLOCK_COMMENT_STYLE
PREFER_ETHER_ADDR_COPY USLEEP_RANGE

U-Boot-Bug-in-cbfs.patch has style problems, please review.

Regards,
Bin
diff mbox

Patch

diff --git a/fs/cbfs/cbfs.c b/fs/cbfs/cbfs.c
index 95a48a4..bfe8e2c 100644
--- a/fs/cbfs/cbfs.c
+++ b/fs/cbfs/cbfs.c
@@ -97,7 +97,7 @@  static int file_cbfs_next_file(u8 *start, u32 size, u32 align,
                }

                swap_file_header(&header, fileHeader);
-               if (header.offset < sizeof(const struct cbfs_cachenode *) ||
+               if (header.offset < sizeof(struct cbfs_fileheader) ||
                                header.offset > header.len) {
                        file_cbfs_result = CBFS_BAD_FILE;
                        return -1;
@@ -106,9 +106,9 @@  static int file_cbfs_next_file(u8 *start, u32
size, u32 align,
                newNode->type = header.type;
                newNode->data = start + header.offset;
                newNode->data_length = header.len;
-               name_len = header.offset - sizeof(struct cbfs_cachenode *);
+               name_len = header.offset - sizeof(struct cbfs_fileheader);
                newNode->name = (char *)fileHeader +
-                               sizeof(struct cbfs_cachenode *);
+                               sizeof(struct cbfs_fileheader);
                newNode->name_length = name_len;
                newNode->checksum = header.checksum;