From: krw Date: Mon, 18 Oct 2021 16:12:02 +0000 (+0000) Subject: r1.66 (May 2014) introduced a two #if 0/#else/#endif chunks to avoid "over X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=bc5b920ff150347d29d0cb7419c1997f2cda5355;p=openbsd r1.66 (May 2014) introduced a two #if 0/#else/#endif chunks to avoid "over optimistic alignment expectations" when extracting a uint32_t field from a packed struct. r1.70 (March 2015) removed one of the two #if 0 chunks, realizing there was no real gain to be had even if various compilers were ever able to intuit the expected alignment. Belatedly nuke the other #if 0 chunk and always memcpy() the uint32_t values out of the struct. --- diff --git a/sbin/fdisk/part.c b/sbin/fdisk/part.c index cd0ecaa2fd2..d65255b0890 100644 --- a/sbin/fdisk/part.c +++ b/sbin/fdisk/part.c @@ -1,4 +1,4 @@ -/* $OpenBSD: part.c,v 1.108 2021/10/10 15:34:21 krw Exp $ */ +/* $OpenBSD: part.c,v 1.109 2021/10/18 16:12:02 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -289,19 +289,12 @@ PRT_parse(const struct dos_partition *dp, const uint64_t lba_self, else off = lba_self; -#if 0 /* XXX */ - prt->prt_bs = letoh32(dp->dp_start) + off; - prt->prt_ns = letoh32(dp->dp_size); - if (prt->prt_id == DOSPTYP_EFI && partn == UINT32_MAX) - prt->prt_ns = DL_GETDSIZE(&dl) - prt->prt_bs; -#else memcpy(&t, &dp->dp_start, sizeof(uint32_t)); prt->prt_bs = letoh32(t) + off; memcpy(&t, &dp->dp_size, sizeof(uint32_t)); prt->prt_ns = letoh32(t); if (prt->prt_id == DOSPTYP_EFI && prt->prt_ns == UINT32_MAX) prt->prt_ns = DL_GETDSIZE(&dl) - prt->prt_bs; -#endif PRT_fix_CHS(prt); }