Re: [PATCH] pstore: add lz4hc and 842 compression support
From: Geliang Tang
Date: Sun Feb 11 2018 - 09:37:57 EST
On Tue, Nov 28, 2017 at 05:44:52PM -0800, Kees Cook wrote:
> > +
> > + ret = LZ4_compress_default(in, out, inlen, outlen, workspace);
> > + if (!ret) {
> > + pr_err("LZ4_compress_default error; compression failed!\n");
> > + return -EIO;
> > + }
> > +
> > + return ret;
>
> Other compress/decompress return outlen, rather than ret. Is "ret" the
> outlen here?
>
> > +
> > + ret = LZ4_compress_HC(in, out, inlen, outlen,
> > + LZ4HC_DEFAULT_CLEVEL, workspace);
> > + if (!ret) {
> > + pr_err("LZ4_compress_HC error; compression failed!\n");
> > + return -EIO;
> > + }
> > +
> > + return ret;
>
> And here?
>
Yes, ret is outlen in LZ4_compress_default and LZ4_compress_HC.
> > +
> > + ret = sw842_compress(in, inlen, out, &len, workspace);
> > + if (!ret) {
> > + pr_err("sw842_compress error; compression failed!\n");
> > + return -EIO;
> > + }
> > + outlen = len;
>
> This has no effect. What was intended?
>
> > + ret = sw842_decompress(in, inlen, out, &len);
> > + if (ret < 0) {
> > + pr_err("sw842_decompress error, ret = %d!\n", ret);
> > + return -EIO;
> > + }
> > + outlen = len;
>
> Same.
>
I fixed them in patch v3.
>
> Otherwise this all looks good. Thanks!
>
> -Kees
>
> --
> Kees Cook
> Pixel Security
Geliang Tang (1):
pstore: add lz4hc and 842 compression support
fs/pstore/Kconfig | 25 +++++++++
fs/pstore/platform.c | 147 ++++++++++++++++++++++++++++++++++++++++++++-------
2 files changed, 154 insertions(+), 18 deletions(-)
--
2.14.1