[U-Boot] [PATCH] fs: cbfs: remove wrong header validation

Christian Gmeiner christian.gmeiner at gmail.com
Thu Sep 20 14:47:06 UTC 2018


Coreboot does not contain such a check:
https://github.com/coreboot/coreboot/blob/eeb4e20b2f6d786c92fe3efb30817e90389a2bfe/src/commonlib/cbfs.c#L64

Before this change cbfsinit failed with 'Bad CBFS file'. After this change all cbfs commands
are working as expected.

Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
---
 fs/cbfs/cbfs.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/fs/cbfs/cbfs.c b/fs/cbfs/cbfs.c
index 0dce639b49..2a581f0c18 100644
--- a/fs/cbfs/cbfs.c
+++ b/fs/cbfs/cbfs.c
@@ -96,11 +96,7 @@ static int file_cbfs_next_file(u8 *start, u32 size, u32 align,
 		}
 
 		swap_file_header(&header, fileHeader);
-		if (header.offset < sizeof(struct cbfs_fileheader) ||
-		    header.offset > header.len) {
-			file_cbfs_result = CBFS_BAD_FILE;
-			return -1;
-		}
+
 		newNode->next = NULL;
 		newNode->type = header.type;
 		newNode->data = start + header.offset;
-- 
2.17.1



More information about the U-Boot mailing list