summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2025-01-15 12:17:28 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2025-01-15 15:28:23 -0500
commitff0b7ed607e779f0e109f7f24388e0ce07af2ebe (patch)
treeb3fc5d65cca49e45c69610b240ec47b1e6e077a3
parenta4e11cea277eee080d421b62e457968fd8c92a53 (diff)
bcachefs: Fix check_inode_hash_info_matches_root()bcachefs-2025-01-20.2
Can't use memcmp() when the struct contains padding. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/str_hash.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/fs/bcachefs/str_hash.c b/fs/bcachefs/str_hash.c
index f5977c5c6743..8c2c5539de2e 100644
--- a/fs/bcachefs/str_hash.c
+++ b/fs/bcachefs/str_hash.c
@@ -167,10 +167,19 @@ found:;
goto err;
struct bch_hash_info hash2 = bch2_hash_info_init(c, &inode);
- if (memcmp(hash_info, &hash2, sizeof(hash2))) {
+ if (hash_info->type != hash2.type ||
+ memcmp(&hash_info->siphash_key, &hash2.siphash_key, sizeof(hash2.siphash_key))) {
ret = repair_inode_hash_info(trans, &inode);
if (!ret) {
- bch_err(c, "inode hash info mismatch with root, but mismatch not found");
+ bch_err(c, "inode hash info mismatch with root, but mismatch not found\n"
+ "%u %llx %llx\n"
+ "%u %llx %llx",
+ hash_info->type,
+ hash_info->siphash_key.k0,
+ hash_info->siphash_key.k1,
+ hash2.type,
+ hash2.siphash_key.k0,
+ hash2.siphash_key.k1);
ret = -BCH_ERR_fsck_repair_unimplemented;
}
}