Skip to content

Commit b007463

Browse files
committed
Addressed copilot comments
1 parent 9ac6b1f commit b007463

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

src/update_flash.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ static int RAMFUNCTION wolfBoot_swap_and_final_erase(int resume)
567567
# define DELTA_BLOCK_SIZE 1024
568568
#endif
569569

570-
static inline uint32_t wb_im2n32(uint32_t val)
570+
static inline uint32_t im2n(uint32_t val)
571571
{
572572
#ifdef BIG_ENDIAN_ORDER
573573
return (((val & 0x000000FFU) << 24) |
@@ -631,9 +631,9 @@ static int wolfBoot_delta_update(struct wolfBoot_image *boot,
631631
&delta_base_hash, &delta_base_hash_sz) < 0) {
632632
return -1;
633633
}
634-
delta_img_size = wb_im2n32(*img_size);
634+
delta_img_size = im2n(*img_size);
635635
if (inverse)
636-
delta_img_offset = wb_im2n32(*img_offset);
636+
delta_img_offset = im2n(*img_offset);
637637
cur_v = wolfBoot_current_firmware_version();
638638
upd_v = wolfBoot_update_firmware_version();
639639
delta_base_v = wolfBoot_get_diffbase_version(PART_UPDATE);

src/x86/ahci.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,10 @@ int sata_unlock_disk(int drv, int freeze)
431431
ata_st = ata_security_get_state(drv);
432432
wolfBoot_printf("ATA: Security state SEC%d\r\n", ata_st);
433433
#if defined(TARGET_x86_fsp_qemu)
434-
if (ata_st == ATA_SEC0)
434+
if (ata_st == ATA_SEC0) {
435+
r = 0;
435436
goto cleanup;
437+
}
436438
#endif
437439
if (ata_st == ATA_SEC1) {
438440
AHCI_DEBUG_PRINTF("ATA: calling set passphrase\r\n", r);

tools/unit-tests/unit-delta.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@
2525
#include <string.h>
2626
#include <stdio.h>
2727
#include <stdlib.h>
28+
#if defined(__unix__) || defined(__APPLE__)
2829
#include <sys/types.h>
2930
#include <sys/wait.h>
3031
#include <unistd.h>
32+
#define HAVE_POSIX_FORK 1
33+
#endif
3134

3235
#include "delta.h"
3336
#define WC_RSA_BLINDING
@@ -485,6 +488,7 @@ END_TEST
485488

486489
START_TEST(test_wb_diff_get_sector_size_rejects_values_above_16bit)
487490
{
491+
#if HAVE_POSIX_FORK
488492
const char *saved = getenv("WOLFBOOT_SECTOR_SIZE");
489493
char *saved_copy = saved ? strdup(saved) : NULL;
490494
pid_t pid;
@@ -510,6 +514,9 @@ START_TEST(test_wb_diff_get_sector_size_rejects_values_above_16bit)
510514
else {
511515
ck_assert_int_eq(unsetenv("WOLFBOOT_SECTOR_SIZE"), 0);
512516
}
517+
#else
518+
ck_assert_int_eq(1, 1);
519+
#endif
513520
}
514521
END_TEST
515522

0 commit comments

Comments
 (0)