Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3617771pxb; Mon, 24 Jan 2022 13:37:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwfLbkZGty80Qlj+cHZ5QHnY0MJ1DP6xnjvWhUrXEi/33dxgE1gYm2ujx2W2OIL2ajJej71 X-Received: by 2002:a17:902:9a09:b0:14a:a0ad:555f with SMTP id v9-20020a1709029a0900b0014aa0ad555fmr15998798plp.119.1643060265138; Mon, 24 Jan 2022 13:37:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643060265; cv=none; d=google.com; s=arc-20160816; b=o8QsO7bnno794mOS7j20Q1+pShpA31Q9TZu9waWRnoB8bM0wKieDbRGXrjAFCgvoA8 Bsn8/I4XYGn2NlNDbeUokxNomV9EzNqID2da8eMSL2aoIYI+xbdCnjAO9IYQtEXedaEf hdF2LNsPQvN/nIQLZ7QThuMcyJNTxk+0QwurtT1BxeIWNQW6shGU9VUJg+flxsQJuDRw 5JU+VWYJOpB8hnM3KaAxNVm6ebMnLRL+IrD1KLrOabHJd+aLrgHSpg1VfZGJPS8YoJN3 vYil5ygp+AXBTZpXsMq4doNSi43BpnvpKiwLHi2EknK84fIT6kJj7S68o6DRPzTkD4gF Sxag== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iSh7rsVKJM9i+xpgcGV+D9JiyLAZLmhSsMwnW6ES/+s=; b=w35qemGFfocZhwqt7e0V3nAqTfNWY3NjQKQK3jBNAUnnEMUrFI2tLPtAeTz9PzNHcQ mIMLFsDQ9oiQvQ5vdga8tiKbIJFVxM+NLSVZXrdYiN+JSBF28oTXtHMrHjnYTn3nyIjO NKEknTtTB0OtRtL917BdPWyg73vP/ePENjBuYSMyqCcYyR/yhcF/sT3LhDDtLmIm3l7+ v9HlJ0ZE52jnaMyMKz6vDRVwW7DwHUJq3lTDOq1O1XKTlVLF9UfyGjxl/7koSWDrMtVr ai+SzF5FGokB8B5p763fsndvUmWNquRoCJrDVuzUffy8Y7eKKNktEyxr8kLmG/UZSLch InRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iUP206pD; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d4si14813340pgv.688.2022.01.24.13.37.33; Mon, 24 Jan 2022 13:37:45 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=iUP206pD; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1449365AbiAXVP2 (ORCPT + 99 others); Mon, 24 Jan 2022 16:15:28 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:47716 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1391493AbiAXUr7 (ORCPT ); Mon, 24 Jan 2022 15:47:59 -0500 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 ams.source.kernel.org (Postfix) with ESMTPS id 1630CB8105C; Mon, 24 Jan 2022 20:47:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C90EC340E5; Mon, 24 Jan 2022 20:47:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057276; bh=IlfeoWM02awDHdswG5X2TjIBFG9nfZxCQnnGwfgarTU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iUP206pD5fEKBB89YfmgIU65VfHAOO+bekWj+wtyBa52YBy1pwy5vPKqawKGhMB+H oR+NegdlyM8Eov8pPGWWgJYGholz2//yDePgMEOUSKz5781XWH2bxlllXLfnOwe45R XN6Z8alcZoo3YcfqsT4fhjRIboW1tRVT0srgIc+Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Harshad Shirwadkar , Theodore Tso , stable@kernel.org Subject: [PATCH 5.15 716/846] ext4: initialize err_blk before calling __ext4_get_inode_loc Date: Mon, 24 Jan 2022 19:43:53 +0100 Message-Id: <20220124184125.722082359@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 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: Harshad Shirwadkar commit c27c29c6af4f3f4ce925a2111c256733c5a5b430 upstream. It is not guaranteed that __ext4_get_inode_loc will definitely set err_blk pointer when it returns EIO. To avoid using uninitialized variables, let's first set err_blk to 0. Reported-by: Dan Carpenter Signed-off-by: Harshad Shirwadkar Link: https://lore.kernel.org/r/20211201163421.2631661-1-harshads@google.com Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman --- fs/ext4/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4371,7 +4371,7 @@ has_buffer: static int __ext4_get_inode_loc_noinmem(struct inode *inode, struct ext4_iloc *iloc) { - ext4_fsblk_t err_blk; + ext4_fsblk_t err_blk = 0; int ret; ret = __ext4_get_inode_loc(inode->i_sb, inode->i_ino, iloc, 0, @@ -4386,7 +4386,7 @@ static int __ext4_get_inode_loc_noinmem( int ext4_get_inode_loc(struct inode *inode, struct ext4_iloc *iloc) { - ext4_fsblk_t err_blk; + ext4_fsblk_t err_blk = 0; int ret; /* We have all inode data except xattrs in memory here. */