From 214f6c2d4cedc84227b7ea453712ab9ddb373d0c Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sun, 26 Apr 2009 21:27:15 -0400 Subject: [PATCH] Exit CBFS file search early if zero signature found. This stops the scan from walking all of flash. --- src/coreboot.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/coreboot.c b/src/coreboot.c index cdb13ba..17c9531 100644 --- a/src/coreboot.c +++ b/src/coreboot.c @@ -331,8 +331,11 @@ cbfs_search(struct cbfs_file *file) for (;;) { if (file < (struct cbfs_file *)(0xFFFFFFFF - ntohl(CBHDR->romsize))) return NULL; - if (file->magic == CBFS_FILE_MAGIC) + u64 magic = file->magic; + if (magic == CBFS_FILE_MAGIC) return file; + if (magic == 0) + return NULL; file = (void*)file + ntohl(CBHDR->align); } } -- 2.39.5