summaryrefslogtreecommitdiff
path: root/firmware/lib
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-01-29 14:28:16 -0800
committerChromeBot <chrome-bot@google.com>2013-01-31 09:38:28 -0800
commit49cb0d3471e768da11fe76b65769bd57dca38bd7 (patch)
tree1d7440fef5d5961de28580dbee9ddca263d175cd /firmware/lib
parentc3d488d155961d2849dfdaa4f0461df1aa95c2ca (diff)
downloadvboot-49cb0d3471e768da11fe76b65769bd57dca38bd7.tar.gz
Add kernel tests
BUG=chromium-os:38139 BRANCH=none TEST=make runtests Change-Id: Iee7c965d5c29063259c66d0ccb117c60f4f4a92e Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/42314
Diffstat (limited to 'firmware/lib')
-rw-r--r--firmware/lib/vboot_kernel.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/firmware/lib/vboot_kernel.c b/firmware/lib/vboot_kernel.c
index ec77de36..a9a6fdf3 100644
--- a/firmware/lib/vboot_kernel.c
+++ b/firmware/lib/vboot_kernel.c
@@ -157,8 +157,7 @@ VbError_t LoadKernel(LoadKernelParams* params) {
int recovery = VBNV_RECOVERY_LK_UNSPECIFIED;
/* Sanity Checks */
- if (!params ||
- !params->bytes_per_lba ||
+ if (!params->bytes_per_lba ||
!params->ending_lba) {
VBDEBUG(("LoadKernel() called with invalid params\n"));
retval = VBERROR_INVALID_PARAMETER;
@@ -210,27 +209,26 @@ VbError_t LoadKernel(LoadKernelParams* params) {
kernel_subkey = &shared->kernel_subkey;
}
- do {
/* Read GPT data */
gpt.sector_bytes = (uint32_t)blba;
gpt.drive_sectors = params->ending_lba + 1;
if (0 != AllocAndReadGptData(params->disk_handle, &gpt)) {
VBDEBUG(("Unable to read GPT data\n"));
shcall->check_result = VBSD_LKC_CHECK_GPT_READ_ERROR;
- break;
+ goto bad_gpt;
}
/* Initialize GPT library */
if (GPT_SUCCESS != GptInit(&gpt)) {
VBDEBUG(("Error parsing GPT\n"));
shcall->check_result = VBSD_LKC_CHECK_GPT_PARSE_ERROR;
- break;
+ goto bad_gpt;
}
/* Allocate kernel header buffers */
kbuf = (uint8_t*)VbExMalloc(KBUF_SIZE);
if (!kbuf)
- break;
+ goto bad_gpt;
/* Loop over candidate kernel partitions */
while (GPT_SUCCESS == GptNextKernelEntry(&gpt, &part_start, &part_size)) {
@@ -516,7 +514,8 @@ VbError_t LoadKernel(LoadKernelParams* params) {
} /* while(GptNextKernelEntry) */
- } while(0);
+
+ bad_gpt:
/* Free kernel buffer */
if (kbuf)