From 5ef2e3e14988cdcfa52103c932186cfdce67f478 Mon Sep 17 00:00:00 2001 From: krw Date: Mon, 25 Apr 2022 13:07:53 +0000 Subject: [PATCH] gh_csum an gh_part_csum are not used between initializing the GPT and calculating them when writing the GPT to disk. No need to update them in add_partition(). Pointed out by jmatthew@ --- sbin/fdisk/gpt.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sbin/fdisk/gpt.c b/sbin/fdisk/gpt.c index 9e2b8fe93fd..608e2828204 100644 --- a/sbin/fdisk/gpt.c +++ b/sbin/fdisk/gpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gpt.c,v 1.73 2022/04/23 14:39:16 krw Exp $ */ +/* $OpenBSD: gpt.c,v 1.74 2022/04/25 13:07:53 krw Exp $ */ /* * Copyright (c) 2015 Markus Muller * Copyright (c) 2015 Kenneth R Westerback @@ -472,7 +472,7 @@ add_partition(const uint8_t *beuuid, const char *name, uint64_t sectors) { struct uuid uuid, gp_type; int rslt; - uint64_t end, freesectors, gpbytes, start; + uint64_t end, freesectors, start; uint32_t status, pn; uuid_dec_be(beuuid, &uuid); @@ -514,10 +514,6 @@ add_partition(const uint8_t *beuuid, const char *name, uint64_t sectors) goto done; uuid_enc_le(&gp[pn].gp_guid, &uuid); - gpbytes = gh.gh_part_num * gh.gh_part_size; - gh.gh_part_csum = crc32((unsigned char *)&gp, gpbytes); - gh.gh_csum = 0; - gh.gh_csum = crc32((unsigned char *)&gh, gh.gh_size); return 0; -- 2.20.1