···178178}179179180180/*181181- * Get the exact inputsize with zero_padding feature.182182- * - For LZ4, it should work if zero_padding feature is on (5.3+);183183- * - For MicroLZMA, it'd be enabled all the time.181181+ * Get the exact on-disk size of the compressed data:182182+ * - For LZ4, it should apply if the zero_padding feature is on (5.3+);183183+ * - For others, zero_padding is enabled all the time.184184 */185185-int z_erofs_fixup_insize(struct z_erofs_decompress_req *rq, const char *padbuf,186186- unsigned int padbufsize)185185+const char *z_erofs_fixup_insize(struct z_erofs_decompress_req *rq,186186+ const char *padbuf, unsigned int padbufsize)187187{188188 const char *padend;189189190190 padend = memchr_inv(padbuf, 0, padbufsize);191191 if (!padend)192192- return -EFSCORRUPTED;192192+ return "compressed data start not found";193193 rq->inputsize -= padend - padbuf;194194 rq->pageofs_in += padend - padbuf;195195- return 0;195195+ return NULL;196196}197197198198static int z_erofs_lz4_decompress_mem(struct z_erofs_decompress_req *rq, u8 *dst)···200200 bool support_0padding = false, may_inplace = false;201201 unsigned int inputmargin;202202 u8 *out, *headpage, *src;203203+ const char *reason;203204 int ret, maptype;204205205206 DBG_BUGON(*rq->in == NULL);···209208 /* LZ4 decompression inplace is only safe if zero_padding is enabled */210209 if (erofs_sb_has_zero_padding(EROFS_SB(rq->sb))) {211210 support_0padding = true;212212- ret = z_erofs_fixup_insize(rq, headpage + rq->pageofs_in,211211+ reason = z_erofs_fixup_insize(rq, headpage + rq->pageofs_in,213212 min_t(unsigned int, rq->inputsize,214213 rq->sb->s_blocksize - rq->pageofs_in));215215- if (ret) {214214+ if (reason) {216215 kunmap_local(headpage);217217- return ret;216216+ return IS_ERR(reason) ? PTR_ERR(reason) : -EFSCORRUPTED;218217 }219218 may_inplace = !((rq->pageofs_in + rq->inputsize) &220219 (rq->sb->s_blocksize - 1));