Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp909912pxb; Sun, 10 Oct 2021 15:00:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkYbFuNzgNc7tcg1GDUiTCb5N1AsDxdtbXuij+KOutr4bcDTLLjrzj4eEiuScXQfNwl/AR X-Received: by 2002:a17:906:7a50:: with SMTP id i16mr21900572ejo.507.1633903259404; Sun, 10 Oct 2021 15:00:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633903259; cv=none; d=google.com; s=arc-20160816; b=HwvQmoNa05PemSuoPjxDbEPz5GsLvb/O54Os6HO8EyHpsLpyKA5uHrYxZtbliUwV0a nOZz0ua01kNPsOZeNw+QPLR6uiVRX9NZoHIfxbzGBR+UxHPFid+CuFRtPBjgN1G5Cvwx Hv2znWjquxqBlgQYH0bQhIqmOoukSpj2+K1SRsf92QgIobnzwU5S4CdZHX7pSN0OgRH+ nUCTbp54RGiC6/+eHXaHtqWZL64sPDV35GGkQvGTM8t5NMuSpQmOhzDThi4wE6wjEGcO 69dMjDoSWK7+pXwvspmtZx3P5Pcuqm2psAsbL6R4MyPCYlc213c/pPdncXw2tPEweHDd CKvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lmtpXADm1dW1dNJsYsqMzMP+k3VqT0PSzXalM3bDxJw=; b=a1jqu7u/2hxDriNEykhPUfKx1rA1IAFTH3Ne1npZTJqS7kZzrhWam5jrTxJcdlAWTh wQDrojlgvxJs4F8C1eEmY6PTyauemwRYagcWkQqx5HqUEKOQCg9QEkRT9mBOy92pPD28 JE6qyirxswonp2E2q3JVrQIAaXRBguFf1PfVCCF/pGgj9Fs+xG3BsdR9qnD6XZoQh8M0 gB6WZU1qDbbvHAJH2ww6CKQTGH3xY/3mdASu1omiC6ww7kWzFYV89KLKs5ti/iger8OY kLfc36VnlUW0wzfNrlHq50aUAyqTBxo9cIBck2fg/SUTQ8b/Iqea3EOS/HQGqSiV/50Q 1jBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AViIxpKl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b8si9206376edm.196.2021.10.10.15.00.35; Sun, 10 Oct 2021 15:00:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AViIxpKl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233106AbhJJVeQ (ORCPT + 99 others); Sun, 10 Oct 2021 17:34:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:58496 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232353AbhJJVeP (ORCPT ); Sun, 10 Oct 2021 17:34:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1CA5060FBF; Sun, 10 Oct 2021 21:32:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633901537; bh=zjy3R1MRHvh/dkVHDeEdi/cGiweG0b5pfdrgoCBELzs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AViIxpKle0TJbAeKrLFAqo0OThzh+X4UdhiT4JIscES0EoA8s25+dLvLt6rSOfKbA YRG5tW79trrjgLHBhUNwtWg1a5SCotUSjn5UpSCPI2Rw5ucF2ctBaYUPHNNy55M2+t iXqgiKW1gCA9YQLgrmgrUH/C12hDVzLix8QHGvVzGL9r0wDMDMj+pj1KkxM4hYJ/d0 gDzbK5FaPY1wBLv7h5bN15Ki7tLdaHcNRIRG4hehpjpB96L9Zm7fpHiEN/2vNDbFbn TLICYzbyz0zwGCzGw6uTyNexGct5RCoNhHKf7y3dFqyFlWUSnMBmZj+uJOykWOlG1I n3fqJB85l4gTw== From: Gao Xiang To: linux-erofs@lists.ozlabs.org, LKML Cc: Lasse Collin , Chao Yu , Andrew Morton , Greg KH , Linus Torvalds , Gao Xiang Subject: [PATCH 3/7] lib/xz: Move s->lzma.len = 0 initialization to lzma_reset() Date: Mon, 11 Oct 2021 05:31:41 +0800 Message-Id: <20211010213145.17462-4-xiang@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211010213145.17462-1-xiang@kernel.org> References: <20211010213145.17462-1-xiang@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lasse Collin It's a more logical place even if the resetting needs to be done only once per LZMA2 stream (if lzma_reset() called in the middle of an LZMA2 stream, .len will already be 0). Signed-off-by: Lasse Collin Signed-off-by: Gao Xiang --- lib/xz/xz_dec_lzma2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/xz/xz_dec_lzma2.c b/lib/xz/xz_dec_lzma2.c index d548cf0e59fe..22b789645ce5 100644 --- a/lib/xz/xz_dec_lzma2.c +++ b/lib/xz/xz_dec_lzma2.c @@ -791,6 +791,7 @@ static void lzma_reset(struct xz_dec_lzma2 *s) s->lzma.rep1 = 0; s->lzma.rep2 = 0; s->lzma.rep3 = 0; + s->lzma.len = 0; /* * All probabilities are initialized to the same value. This hack @@ -1174,8 +1175,6 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_reset(struct xz_dec_lzma2 *s, uint8_t props) } } - s->lzma.len = 0; - s->lzma2.sequence = SEQ_CONTROL; s->lzma2.need_dict_reset = true; -- 2.20.1