diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 19:33:32 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 19:33:32 +0000 |
commit | 8bb05ac73a5b448b339ce0bc8d396c82c459b47f (patch) | |
tree | 1fdda006866bca20d41cb206767ea5241e36852f /libblkid/src/superblocks/linux_raid.c | |
parent | Adding debian version 2.39.3-11. (diff) | |
download | util-linux-8bb05ac73a5b448b339ce0bc8d396c82c459b47f.tar.xz util-linux-8bb05ac73a5b448b339ce0bc8d396c82c459b47f.zip |
Merging upstream version 2.40.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libblkid/src/superblocks/linux_raid.c')
-rw-r--r-- | libblkid/src/superblocks/linux_raid.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/libblkid/src/superblocks/linux_raid.c b/libblkid/src/superblocks/linux_raid.c index 360cd4e..156b0bf 100644 --- a/libblkid/src/superblocks/linux_raid.c +++ b/libblkid/src/superblocks/linux_raid.c @@ -187,15 +187,14 @@ static int raid1_verify_csum(blkid_probe pr, off_t off, { size_t csummed_size = sizeof(struct mdp1_super_block) + le32_to_cpu(mdp1->max_dev) * sizeof(mdp1->dev_roles[0]); - unsigned char *csummed = blkid_probe_get_buffer(pr, off, csummed_size); + const unsigned char *csummed = blkid_probe_get_buffer(pr, off, csummed_size); if (!csummed) return 1; - memset(csummed + offsetof(struct mdp1_super_block, sb_csum), 0, - sizeof(mdp1->sb_csum)); - uint64_t csum = 0; + csum -= le32_to_cpu(*(uint32_t *) (csummed + offsetof(struct mdp1_super_block, sb_csum))); + while (csummed_size >= 4) { csum += le32_to_cpu(*(uint32_t *) csummed); csummed_size -= 4; |