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>
diff --git a/firmware/lib/vboot_kernel.c b/firmware/lib/vboot_kernel.c
index 1de3491..8703697 100644
--- a/firmware/lib/vboot_kernel.c
+++ b/firmware/lib/vboot_kernel.c
@@ -365,8 +365,7 @@
}
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 @@
/* 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 @@
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 @@
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 @@
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;