diff options
Diffstat (limited to 'fs/erofs/decompressor_lzma.c')
| -rw-r--r-- | fs/erofs/decompressor_lzma.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/fs/erofs/decompressor_lzma.c b/fs/erofs/decompressor_lzma.c index 832cffb83a66..b4ea6978faae 100644 --- a/fs/erofs/decompressor_lzma.c +++ b/fs/erofs/decompressor_lzma.c @@ -146,23 +146,23 @@ again: return err; } -static int z_erofs_lzma_decompress(struct z_erofs_decompress_req *rq, - struct page **pgpl) +static const char *z_erofs_lzma_decompress(struct z_erofs_decompress_req *rq, + struct page **pgpl) { struct super_block *sb = rq->sb; struct z_erofs_stream_dctx dctx = { .rq = rq, .no = -1, .ni = 0 }; struct xz_buf buf = {}; struct z_erofs_lzma *strm; enum xz_ret xz_err; - int err; + const char *reason; /* 1. get the exact LZMA compressed size */ dctx.kin = kmap_local_page(*rq->in); - err = z_erofs_fixup_insize(rq, dctx.kin + rq->pageofs_in, + reason = z_erofs_fixup_insize(rq, dctx.kin + rq->pageofs_in, min(rq->inputsize, sb->s_blocksize - rq->pageofs_in)); - if (err) { + if (reason) { kunmap_local(dctx.kin); - return err; + return reason; } /* 2. get an available lzma context */ @@ -188,9 +188,9 @@ again: dctx.avail_out = buf.out_size - buf.out_pos; dctx.inbuf_sz = buf.in_size; dctx.inbuf_pos = buf.in_pos; - err = z_erofs_stream_switch_bufs(&dctx, (void **)&buf.out, - (void **)&buf.in, pgpl); - if (err) + reason = z_erofs_stream_switch_bufs(&dctx, (void **)&buf.out, + (void **)&buf.in, pgpl); + if (reason) break; if (buf.out_size == buf.out_pos) { @@ -207,9 +207,9 @@ again: if (xz_err != XZ_OK) { if (xz_err == XZ_STREAM_END && !rq->outputsize) break; - erofs_err(sb, "failed to decompress %d in[%u] out[%u]", - xz_err, rq->inputsize, rq->outputsize); - err = -EFSCORRUPTED; + reason = (xz_err == XZ_DATA_ERROR ? + "corrupted compressed data" : + "unexpected end of stream"); break; } } while (1); @@ -223,7 +223,7 @@ again: z_erofs_lzma_head = strm; spin_unlock(&z_erofs_lzma_lock); wake_up(&z_erofs_lzma_wq); - return err; + return reason; } const struct z_erofs_decompressor z_erofs_lzma_decomp = { |
