oend = rq->pageofs_out + rq->outputsize;
omargin = PAGE_ALIGN(oend) - oend;
if (!rq->partial_decoding && may_inplace &&
- rq->outpages >= rq->inpages &&
omargin >= LZ4_DECOMPRESS_INPLACE_MARGIN(rq->inputsize)) {
for (i = 0; i < rq->inpages; ++i)
if (rq->out[rq->outpages - rq->inpages + i] !=
}
if (m.headtype == Z_EROFS_LCLUSTER_TYPE_PLAIN) {
- if (map->m_llen > map->m_plen) {
- DBG_BUGON(1);
- err = -EFSCORRUPTED;
- goto unmap_out;
- }
if (vi->z_advise & Z_EROFS_ADVISE_INTERLACED_PCLUSTER)
map->m_algorithmformat = Z_EROFS_COMPRESSION_INTERLACED;
else
map->m_algorithmformat, map->m_la, EROFS_I(inode)->nid);
return -EOPNOTSUPP;
}
- if (unlikely(map->m_algorithmformat < Z_EROFS_COMPRESSION_MAX &&
- !(sbi->available_compr_algs & (1 << map->m_algorithmformat)))) {
- erofs_err(inode->i_sb, "inconsistent algorithmtype %u for nid %llu",
- map->m_algorithmformat, EROFS_I(inode)->nid);
+
+ if (map->m_algorithmformat < Z_EROFS_COMPRESSION_MAX) {
+ if (sbi->available_compr_algs ^ BIT(map->m_algorithmformat)) {
+ erofs_err(inode->i_sb, "inconsistent algorithmtype %u for nid %llu",
+ map->m_algorithmformat, EROFS_I(inode)->nid);
+ return -EFSCORRUPTED;
+ }
+ if (EROFS_MAP_FULL(map->m_flags) && map->m_llen < map->m_plen) {
+ erofs_err(inode->i_sb, "too much compressed data @ la %llu of nid %llu",
+ map->m_la, EROFS_I(inode)->nid);
+ return -EFSCORRUPTED;
+ }
+ } else if (map->m_llen > map->m_plen) {
+ erofs_err(inode->i_sb, "not enough plain data on disk @ la %llu of nid %llu",
+ map->m_la, EROFS_I(inode)->nid);
return -EFSCORRUPTED;
}
if (unlikely(map->m_plen > Z_EROFS_PCLUSTER_MAX_SIZE ||