Skip to content

Commit

Permalink
integrity: print debug message if superblock metadata read fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroz committed Oct 8, 2024
1 parent 79ef5be commit 443a555
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/integrity/integrity.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ static int INTEGRITY_read_superblock(struct crypt_device *cd,
return -EINVAL;

if (read_lseek_blockwise(devfd, device_block_size(cd, device),
device_alignment(device), sb, sizeof(*sb), offset) != sizeof(*sb) ||
memcmp(sb->magic, SB_MAGIC, sizeof(sb->magic))) {
device_alignment(device), sb, sizeof(*sb), offset) != sizeof(*sb)) {
log_dbg(cd, "Cannot read kernel dm-integrity metadata on %s.", device_path(device));
return -EINVAL;
}

if (memcmp(sb->magic, SB_MAGIC, sizeof(sb->magic))) {
log_dbg(cd, "No kernel dm-integrity metadata detected on %s.", device_path(device));
r = -EINVAL;
} else if (sb->version < SB_VERSION_1 || sb->version > SB_VERSION_5) {
Expand Down

0 comments on commit 443a555

Please sign in to comment.