Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3663335pxb; Mon, 24 Jan 2022 14:47:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJyHe+VavkfA3uikqrSXzdPCqYv5hhHG4DpghpzSgaVnH5r/R6Y7S3rRqxaeCrd+bJA0479o X-Received: by 2002:a17:903:1107:b0:149:98f7:9629 with SMTP id n7-20020a170903110700b0014998f79629mr16173992plh.160.1643064452352; Mon, 24 Jan 2022 14:47:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643064452; cv=none; d=google.com; s=arc-20160816; b=CAxULzt4Tuwdyk3Ofl1iYjHYxnbv5fIgozFW/bQ/kW+6HWGuX3JehYUDtCyq072I9A XjupwCGN9rOHAsDDOLCo/RPP2Mw3/9KEcNoQQ5KpFJdTy8/+9qpSiGOhzzDm68No6UuO 9EWF2jwhbKxpe8374BQSvIvU0bQMOLPUmOv7ZjtDbUZWL0rcmwgi6KPbfWyQzF37fg/O 6h6AnfgZk0+12uBKMssWxkT08qzTPMMCyPTkFgDlWBaY8MkGofQnAvPeoajf9v+LB5sM /vgOtOUpjnJBIKpLw7QYHnRTPcy3dDW1f3xg3MefQJ6u8hscEnqS8TWDk7VBHsprFcdK v0gA== 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=E/qkCXGZl6cWz9wN/A0LVVqoP2I0yLJvAqrFVBCXNP4=; b=naYKvcu0/h69u4v6Muv88aAkYqeNcPzaUJ3mGU9mj7SyXdPMrfbsBjW6olBqdeu/C9 cpGAWqnYjc0hCo9G1kHWkFRGgBFMxo+8uStpDPOHqpbu9QO6Rti0ztVbsB+5L4mIewDZ +vm9QKO9qiyXXhzWYBSBuiCiuTOO+pvdMq0uIjz0KoQLksJYvSP6kKEfn2Y/F3hru7W8 RR3w7Wae7eDo8czHZS1MIGpLlp+1erDPA+qe4wRms0Nn80KfEFMoWsqrLRUAWmWM3Vig 98AE9/lpurV3MXMit6N9LBTj28DTt7iZayxkwnrFbxUlXbFUx+VKyVbk+bBzJWvhDKrC Eaig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=doSjkcah; 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 b9si17606371plh.37.2022.01.24.14.47.20; Mon, 24 Jan 2022 14:47:32 -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=doSjkcah; 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 S1837831AbiAXWpZ (ORCPT + 99 others); Mon, 24 Jan 2022 17:45:25 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54650 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456098AbiAXVht (ORCPT ); Mon, 24 Jan 2022 16:37:49 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 8872861510; Mon, 24 Jan 2022 21:37:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BFCEC340E4; Mon, 24 Jan 2022 21:37:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060265; bh=OLpI67k/l5+6Nfl6y5XUeykp7wBmqWj5duco+nik+zA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=doSjkcahvqQOPe8RDHA0Mb7Is1CQ49RP5R16Ywj+ATl9MECvluCiQxxH4M8rplJIy vf72SBpkrw4zPA7+Oy/V1c3WhQqqRdSI22oBBVKK+pVVw1VfcCDRDBp1fE0TO5PsNF cpQHucQhKNeiDzDXAh9ccBBa/0dIMUC8IekdC/yg= 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.16 0892/1039] ext4: initialize err_blk before calling __ext4_get_inode_loc Date: Mon, 24 Jan 2022 19:44:41 +0100 Message-Id: <20220124184155.269572866@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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 @@ -4523,7 +4523,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, NULL, iloc, @@ -4538,7 +4538,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; ret = __ext4_get_inode_loc(inode->i_sb, inode->i_ino, inode, iloc,