From: Thomas Weißschuh Date: Thu, 27 Feb 2025 17:15:56 +0000 (+0100) Subject: libblkid: ddf_raid: drop little-endian handling X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3836dc49923e3a121ffcc7c7d8ec6640d1fcf843;p=thirdparty%2Futil-linux.git libblkid: ddf_raid: drop little-endian handling The DDF specification, both 1.2 and 2.0 require big-endian. This is also what mdadm expects. 5.2 Byte Ordering Each section of the DDF MUST be stored in big-endian format (i.e., the more significant bytes of the section are stored in lower addresses in relation to bytes of lesser significance). Signed-off-by: Thomas Weißschuh --- diff --git a/libblkid/src/superblocks/ddf_raid.c b/libblkid/src/superblocks/ddf_raid.c index f3be81574..f5b52bff2 100644 --- a/libblkid/src/superblocks/ddf_raid.c +++ b/libblkid/src/superblocks/ddf_raid.c @@ -88,8 +88,7 @@ static int probe_ddf(blkid_probe pr, sizeof(struct ddf_header)); if (!ddf) return errno ? -errno : 1; - if (ddf->signature == cpu_to_be32(DDF_MAGIC) || - ddf->signature == cpu_to_le32(DDF_MAGIC)) + if (ddf->signature == cpu_to_be32(DDF_MAGIC)) break; ddf = NULL; } @@ -97,9 +96,7 @@ static int probe_ddf(blkid_probe pr, if (!ddf) return 1; - lba = ddf->signature == cpu_to_be32(DDF_MAGIC) ? - be64_to_cpu(ddf->primary_lba) : - le64_to_cpu(ddf->primary_lba); + lba = be64_to_cpu(ddf->primary_lba); if (lba > 0) { /* check primary header */