From a75d3348fb8d366ae61bdff59c8959641e0beb6a Mon Sep 17 00:00:00 2001 From: mintsuki Date: Thu, 31 Mar 2022 07:48:00 +0200 Subject: [PATCH] s2deploy: Fix bugs with 4dcd94f --- limine-s2deploy/limine-s2deploy.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/limine-s2deploy/limine-s2deploy.c b/limine-s2deploy/limine-s2deploy.c index 5564b4aa..01ce2d2a 100644 --- a/limine-s2deploy/limine-s2deploy.c +++ b/limine-s2deploy/limine-s2deploy.c @@ -166,11 +166,11 @@ static uint64_t endswap64(uint64_t value) { return ret; } -#define ENDSWAP(VALUE) (bigendian ? ( \ - sizeof(VALUE) == 8 ? (VALUE) : \ - sizeof(VALUE) == 16 ? endswap16(VALUE) : \ - sizeof(VALUE) == 32 ? endswap32(VALUE) : \ - sizeof(VALUE) == 64 ? endswap64(VALUE) : (abort(), 1) \ +#define ENDSWAP(VALUE) (bigendian ? ( \ + sizeof(VALUE) == 1 ? (VALUE) : \ + sizeof(VALUE) == 2 ? endswap16(VALUE) : \ + sizeof(VALUE) == 4 ? endswap32(VALUE) : \ + sizeof(VALUE) == 8 ? endswap64(VALUE) : (abort(), 1) \ ) : (VALUE)) static enum { @@ -631,7 +631,7 @@ int main(int argc, char *argv[]) { secondary_gpt_header.crc32 = crc32(&secondary_gpt_header, 92); secondary_gpt_header.crc32 = ENDSWAP(secondary_gpt_header.crc32); device_write(&secondary_gpt_header, - lb_size * gpt_header.alternate_lba, + lb_size * ENDSWAP(gpt_header.alternate_lba), sizeof(struct gpt_table_header)); } } else {