Although very unlikely, if there is a header that has no item in it,
build_chunk_tree() left @item as NULL, then later during the error
message we still call "get_unaligned_le64(&item->bytenr)", which is
going to trigger a NULL-pointer dereference.
Fix it by removing the get_unaligned_le64() call.
Assisted-by: LLM (exposing the bug)
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
}
if (!item || get_unaligned_le64(&item->bytenr) != BTRFS_SUPER_INFO_OFFSET) {
- error("did not find superblock at %llu", get_unaligned_le64(&item->bytenr));
+ error("did not find superblock");
return -EINVAL;
}