From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753479AbeBKOhq (ORCPT ); Sun, 11 Feb 2018 09:37:46 -0500 Received: from mail-pl0-f42.google.com ([209.85.160.42]:46253 "EHLO mail-pl0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751822AbeBKOho (ORCPT ); Sun, 11 Feb 2018 09:37:44 -0500 X-Google-Smtp-Source: AH8x224Im8njRiPMxxrTEMQTcbAic0fmfWUjBeHXzPfBrdsgvNKffZu24wdj5Nin9jaxgoZPU3Wisg== From: Geliang Tang To: Kees Cook , Anton Vorontsov , Colin Cross , Tony Luck Cc: Geliang Tang , linux-kernel@vger.kernel.org Subject: Re: [PATCH] pstore: add lz4hc and 842 compression support Date: Sun, 11 Feb 2018 22:37:30 +0800 Message-Id: X-Mailer: git-send-email 2.14.1 In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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