summaryrefslogtreecommitdiffstats
path: root/super-ddf.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2008-10-27 10:04:46 +1100
committerNeilBrown <neilb@suse.de>2008-10-27 10:04:46 +1100
commit4abe6b708687f9982bfbc0629e1070bf49714fa3 (patch)
tree12f4164c346ce5e52157dc2dc15fa1205182e9df /super-ddf.c
parent0febf9a94d89bac9fbbe314ca9bdb6c615616498 (diff)
downloadmdadm-4abe6b708687f9982bfbc0629e1070bf49714fa3.tar.gz
mdadm-4abe6b708687f9982bfbc0629e1070bf49714fa3.tar.xz
mdadm-4abe6b708687f9982bfbc0629e1070bf49714fa3.zip
ddf: get endian-ness of CRC correct.
All numeric fields in a DDF header big-endian, including the CRC, so better fix that. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'super-ddf.c')
-rw-r--r--super-ddf.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/super-ddf.c b/super-ddf.c
index db6476b..4264bdf 100644
--- a/super-ddf.c
+++ b/super-ddf.c
@@ -446,7 +446,10 @@ static int calc_crc(void *buf, int len)
newcrc = crc32(0, buf, len);
ddf->crc = oldcrc;
- return newcrc;
+ /* The crc is store (like everything) bigendian, so convert
+ * here for simplicity
+ */
+ return __cpu_to_be32(newcrc);
}
static int load_ddf_header(int fd, unsigned long long lba,