]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
ddf: get endian-ness of CRC correct.
authorNeilBrown <neilb@suse.de>
Sun, 26 Oct 2008 23:04:46 +0000 (10:04 +1100)
committerNeilBrown <neilb@suse.de>
Sun, 26 Oct 2008 23:04:46 +0000 (10:04 +1100)
All numeric fields in a DDF header big-endian, including the CRC, so
better fix that.

Signed-off-by: NeilBrown <neilb@suse.de>
super-ddf.c

index db6476b14c0115e0c9af3481d0c367d6df178956..4264bdf726984161af95874583a01d340764c6ff 100644 (file)
@@ -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,