Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 52EC0C433F5 for ; Tue, 26 Apr 2022 15:27:14 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.94.2) (envelope-from ) id 1njN5t-0002q1-5R; Tue, 26 Apr 2022 15:27:12 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1njN5r-0002po-TN for linux-f2fs-devel@lists.sourceforge.net; Tue, 26 Apr 2022 15:27:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=En+lqQ8swyKhSA/xbE03nx2mdFdta6drixsieWXfXwY=; b=TY7JmGJZnIdLrx0kaxp68H2zLe 5/TiQHMMjfFD9SLl0YILGOjqtu0dNdChSkyJ6kbXk2Wr15C/cUDrxA0SqlgwUa8Tk+LWxc5aPH2b/ F27vD2IJB0HszQOAKWXHcq+9e+9iaFOCT3fqpzdbFSNgiKIiLAjNLJrwc0/38O3u+hm8=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=En+lqQ8swyKhSA/xbE03nx2mdFdta6drixsieWXfXwY=; b=Z st0RG20BIa0nZwzRDP7qO5zfvuiB/mJO2Gs5eoL5lZXMWVUTZyYalmaCYqnQoXEkjS7Dy4KJ5B58k YK2nVWUPzw/wtCdbAxKQIpVpbc8fpjTCTFUWOBJeoQk5ly0T4PYmGYFkZ9CFGs2VPTQVzxsnm1yZY LdGv7osWqR53pmhU=; Received: from dfw.source.kernel.org ([139.178.84.217]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.94.2) id 1njN5n-00Am6X-A7 for linux-f2fs-devel@lists.sourceforge.net; Tue, 26 Apr 2022 15:27:10 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 126FB6196E; Tue, 26 Apr 2022 15:26:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47898C385A0; Tue, 26 Apr 2022 15:26:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650986816; bh=2hTGeRgPDbSTyAVeec+ApELlltc5xubB+dLaXFYQPzM=; h=From:To:Cc:Subject:Date:From; b=IaKE6KOKpm0SCDBcF8v/3Lks/+ii2GqXDoMPxnb52pJw1tfX2I0F4i6PWhS0XBui8 NEqglz2ycdcBv36327ZG3T8V0Diuq/Tvt/KLN31BYKx1QB+jUn0oDSRL+KosMa/zZt 7zN+E6V79H4/teZRzdAm+7QiB8LPrCwhbGeAZqBw2MZRBKT1OUmUZjWJg1EP6SEz+y LK4UsX1Hgpvip6bf/TO3HA+SqTI9qauFdYQGGkcZg/j2RuM4dLu5qwtlBEdsI9M53L vpuu93mfADjoPafUtWqf0FfRG7f+mfoSg5KSjRKeTP4OveQFSJnaPUHKyPnoYsEKF7 Tb3erJGGlzDuw== From: Chao Yu To: jaegeuk@kernel.org Date: Tue, 26 Apr 2022 23:26:46 +0800 Message-Id: <20220426152646.5721-1-chao@kernel.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-Headers-End: 1njN5n-00Am6X-A7 Subject: [f2fs-dev] [PATCH] dump.f2fs: compress: fix dstlen of LZ4_compress_fast_extState() X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Compressed cluster content includes compress cluster header, so calculation of dstlen parameter in LZ4_compress_fast_extState() should consider this design, otherwise compressed data may overflow destination buffer during compression. Signed-off-by: Chao Yu --- fsck/compress.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fsck/compress.c b/fsck/compress.c index 620768d..b413492 100644 --- a/fsck/compress.c +++ b/fsck/compress.c @@ -86,7 +86,8 @@ static int lz4_compress(struct compress_ctx *cc) { cc->clen = LZ4_compress_fast_extState(cc->private, cc->rbuf, (char *)cc->cbuf->cdata, cc->rlen, - cc->rlen - F2FS_BLKSIZE * c.compress.min_blocks, + cc->rlen - F2FS_BLKSIZE * c.compress.min_blocks - + COMPRESS_HEADER_SIZE, LZ4_ACCELERATION_DEFAULT); if (!cc->clen) -- 2.32.0 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel