Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp419847pxf; Wed, 7 Apr 2021 02:51:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzISy61WeOL8jWAPYK15LKWCZEBIYx/yc/52dmkmtZWEYLRc5rmtFv9/6N17fT7fW0iRyrb X-Received: by 2002:a50:f695:: with SMTP id d21mr3331408edn.382.1617789099570; Wed, 07 Apr 2021 02:51:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617789099; cv=none; d=google.com; s=arc-20160816; b=rXcGQ8xpLHVsAZ9is+oK0XAXCy8WuJsdyZ9+MJSEUApSBX0aXFVXDslyURNAKLBZY4 r2uT7oG5z0Mu5VSlqby0OL7lSnfiQA7kGqyzPL6gvNPJ3bUUVR5vIs1ZApZRt5+/rVu3 xdJEWeRLz8bkRnx7bhdQMEv3/JmRbmBziTjWiSh007KB/kC7n23qgDjB2Eh7NSS86ynJ WqZp3SGxr9o4ZFeYwrpPsRHmyOLEkrGJ4KuhuLo9lLpQPb1baMOJPnLxyGfpQZedrGyU JItK8BleyjY3G5+7cBP435UiHtENyeP2nbZ8nZ7Le98eWeAczFV2+NhLjIKk15orZh/s /t+w== 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 :message-id:date:subject:cc:to:from; bh=2T2OlFwRobBYqcR87wB/395kmZE2EE6lVkV/CDth4vs=; b=HDi0rcR8I/I1r4SM+7iwEj7J/+wY/Yzk9Ccn0EneEfSGX3atAArqeKvJudPq7cHiMF j1lH32IHZClTdyjzA2ZfbhsbqbwOPhDnzbF7M7lPHMWQqlWYud+1q2GEI9wBkwUGgwEd 9GpeJE20sM1acpjZAaKakQufgqJVyTjuzRo/ODO5PC7Y1eAYUSS7+MtpVdMvKgur9Isz mXC2XM79Wx+oRvJ++tfPjGBjFCwaOQsu+EENOWehu+xgLAZPzj7qxiyKDOsy8hMGx6cH pylBpHd00kp6AgEXIO9lEFj581V20ty3zmKj65Vs5bSMHYsLamGNdFtiK8Kyxvz1c8l6 p6Ww== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pg24si9548577ejb.341.2021.04.07.02.51.14; Wed, 07 Apr 2021 02:51:39 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244012AbhDFQ1b (ORCPT + 99 others); Tue, 6 Apr 2021 12:27:31 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:39392 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244099AbhDFQ1a (ORCPT ); Tue, 6 Apr 2021 12:27:30 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lToXv-0006Um-2c; Tue, 06 Apr 2021 16:27:19 +0000 From: Colin King To: Gao Xiang , Chao Yu , linux-erofs@lists.ozlabs.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] erofs: fix uninitialized variable i used in a while-loop Date: Tue, 6 Apr 2021 17:27:18 +0100 Message-Id: <20210406162718.429852-1-colin.king@canonical.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King The while-loop iterates until src is non-null or i is 3, however, the loop counter i is not intinitialied to zero, causing incorrect iteration counts. Fix this by initializing it to zero. Addresses-Coverity: ("Uninitialized scalar variable") Fixes: 1aa5f2e2feed ("erofs: support decompress big pcluster for lz4 backend") Signed-off-by: Colin Ian King --- fs/erofs/decompressor.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c index fe46a9c34923..8687ff81406b 100644 --- a/fs/erofs/decompressor.c +++ b/fs/erofs/decompressor.c @@ -154,6 +154,7 @@ static void *z_erofs_handle_inplace_io(struct z_erofs_decompress_req *rq, } kunmap_atomic(inpage); might_sleep(); + i = 0; while (1) { src = vm_map_ram(rq->in, nrpages_in, -1); /* retry two more times (totally 3 times) */ -- 2.30.2