From 2ffbdc7e0261695df4345b73134a89074b5aab74 Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Mon, 25 Apr 2022 13:07:54 +0000 Subject: 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(-) (limited to 'sbin/fdisk') 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; -- cgit v1.2.3