diff --git a/e2fsck/super.c b/e2fsck/super.c index 6964e2ddae39..d1da2c16bb02 100644 --- a/e2fsck/super.c +++ b/e2fsck/super.c @@ -578,11 +578,9 @@ static int reinit_orphan_block(ext2_filsys fs, e2fsck_t ctx; blk64_t blk = *block_nr; struct problem_context pctx; - struct ext4_orphan_block_tail *tail; pd = priv_data; ctx = pd->ctx; - tail = ext2fs_orphan_block_tail(fs, pd->buf); /* Orphan file must not have holes */ if (!blk) { @@ -597,12 +595,18 @@ return_abort: pd->abort = 1; return BLOCK_ABORT; } - /* - * Update checksum to match expected buffer contents with appropriate - * block number. - */ - tail->ob_checksum = ext2fs_do_orphan_file_block_csum(fs, pd->ino, - pd->generation, blk, pd->buf); + + if (ext2fs_has_feature_metadata_csum(fs->super)) { + struct ext4_orphan_block_tail *tail; + + tail = ext2fs_orphan_block_tail(fs, pd->buf); + /* + * Update checksum to match expected buffer contents with + * appropriate block number. + */ + tail->ob_checksum = ext2fs_do_orphan_file_block_csum(fs, + pd->ino, pd->generation, blk, pd->buf); + } if (!pd->clear) { pd->errcode = io_channel_read_blk64(fs->io, blk, 1, pd->block_buf);