summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2021-04-19 17:42:16 +0800
committerCommit Bot <commit-bot@chromium.org>2021-05-09 19:28:29 +0000
commite79d276999bc92409df399c1f3cbb5b3b941ee4d (patch)
tree04f0479ea3a31739b83b6ee5ce5071077acbdb7a
parentf3f56e94c79ffdeda4ad1aa4b3ae120deb502682 (diff)
downloadvboot-e79d276999bc92409df399c1f3cbb5b3b941ee4d.tar.gz
vboot/vboot_kernel: fix various style issues
Change conditional checks to match other vboot code. Instead of: if (rv != VB2_SUCCESS) Just use: if (rv) Also fix up spacing on a vb2_load_partition call. This CL is part of a series to merge vboot1 and vboot2.0 kernel verification code; see b/181739551. BUG=b:181739551 TEST=make clean && make runtests BRANCH=none Signed-off-by: Joel Kitching <kitching@google.com> Change-Id: Ifc6dd5a3e5263d66f279f56919c05064dd49a7a7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2835505 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
-rw-r--r--firmware/lib/vboot_kernel.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/firmware/lib/vboot_kernel.c b/firmware/lib/vboot_kernel.c
index 1de3491a..8703697e 100644
--- a/firmware/lib/vboot_kernel.c
+++ b/firmware/lib/vboot_kernel.c
@@ -365,8 +365,7 @@ static vb2_error_t vb2_load_partition(
}
read_ms += vb2ex_mtime() - start_ts;
- if (VB2_SUCCESS !=
- vb2_verify_kernel_vblock(ctx, kbuf, KBUF_SIZE, &wblocal)) {
+ if (vb2_verify_kernel_vblock(ctx, kbuf, KBUF_SIZE, &wblocal)) {
return VB2_ERROR_LOAD_PARTITION_VERIFY_VBLOCK;
}
@@ -430,7 +429,7 @@ static vb2_error_t vb2_load_partition(
/* Get key for preamble/data verification from the keyblock. */
struct vb2_public_key data_key;
- if (VB2_SUCCESS != vb2_unpack_key(&data_key, &keyblock->data_key)) {
+ if (vb2_unpack_key(&data_key, &keyblock->data_key)) {
VB2_DEBUG("Unable to unpack kernel data key\n");
return VB2_ERROR_LOAD_PARTITION_DATA_KEY;
}
@@ -439,9 +438,8 @@ static vb2_error_t vb2_load_partition(
data_key.allow_hwcrypto = 1;
/* Verify kernel data */
- if (VB2_SUCCESS != vb2_verify_data(kernbuf, kernbuf_size,
- &preamble->body_signature,
- &data_key, &wblocal)) {
+ if (vb2_verify_data(kernbuf, kernbuf_size, &preamble->body_signature,
+ &data_key, &wblocal)) {
VB2_DEBUG("Kernel data verification failed.\n");
return VB2_ERROR_LOAD_PARTITION_VERIFY_BODY;
}
@@ -484,21 +482,21 @@ vb2_error_t LoadKernel(struct vb2_context *ctx, LoadKernelParams *params)
gpt.gpt_drive_sectors = params->gpt_lba_count;
gpt.flags = params->boot_flags & BOOT_FLAG_EXTERNAL_GPT
? GPT_FLAG_EXTERNAL : 0;
- if (0 != AllocAndReadGptData(params->disk_handle, &gpt)) {
+ if (AllocAndReadGptData(params->disk_handle, &gpt)) {
VB2_DEBUG("Unable to read GPT data\n");
goto gpt_done;
}
/* Initialize GPT library */
- if (GPT_SUCCESS != GptInit(&gpt)) {
+ if (GptInit(&gpt)) {
VB2_DEBUG("Error parsing GPT\n");
goto gpt_done;
}
/* Loop over candidate kernel partitions */
uint64_t part_start, part_size;
- while (GPT_SUCCESS ==
- GptNextKernelEntry(&gpt, &part_start, &part_size)) {
+ while (GptNextKernelEntry(&gpt, &part_start, &part_size) ==
+ GPT_SUCCESS) {
VB2_DEBUG("Found kernel entry at %"
PRIu64 " size %" PRIu64 "\n",
@@ -526,14 +524,10 @@ vb2_error_t LoadKernel(struct vb2_context *ctx, LoadKernelParams *params)
lpflags |= VB2_LOAD_PARTITION_VBLOCK_ONLY;
}
- rv = vb2_load_partition(ctx,
- stream,
- lpflags,
- params,
- &wb);
+ rv = vb2_load_partition(ctx, stream, lpflags, params, &wb);
VbExStreamClose(stream);
- if (rv != VB2_SUCCESS) {
+ if (rv) {
VB2_DEBUG("Marking kernel as invalid.\n");
GptUpdateKernelEntry(&gpt, GPT_UPDATE_ENTRY_BAD);
continue;