From patchwork Wed Dec 1 16:34:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: harshad shirwadkar X-Patchwork-Id: 1562306 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=q0LBMW06; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee2:21ea]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4J44S64QGjz9sRN for ; Thu, 2 Dec 2021 03:34:46 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee2:21ea]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4J44S53l87z4xYy for ; Thu, 2 Dec 2021 03:34:45 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4J44S53h5Mz4xZ4; Thu, 2 Dec 2021 03:34:45 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=q0LBMW06; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4J44S50hrXz4xYy for ; Thu, 2 Dec 2021 03:34:45 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347953AbhLAQiE (ORCPT ); Wed, 1 Dec 2021 11:38:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351107AbhLAQiA (ORCPT ); Wed, 1 Dec 2021 11:38:00 -0500 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2850C061748 for ; Wed, 1 Dec 2021 08:34:39 -0800 (PST) Received: by mail-pl1-x629.google.com with SMTP id z6so18132706plk.6 for ; Wed, 01 Dec 2021 08:34:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fBElkur6LZmhvoW3bpkBRdx7KWPV73Vhiu0rYHr4YMM=; b=q0LBMW064LM05W/yKb489eACmvMqpYTbpNwORh7Ki/utFTeYIQIDlBTZCyrkrqfgQo tUTRm5oRjof9WlL1f0jesBQe69bQu2cGooYSEEa3ugZSFgXV1v7mSchxBMnM4YtkNWmR 82ZoBXpOi75GJX9DNihIZ9ZK3oU4sLpf8NGFp6kIgt44Zc9kP8CZTYSo25jbZN29wkGM H+8j3KaZCQt36E0HiUtIPyhj+FJHDRQoGHF00IqdpzempmNIpyYNyUTn1nqUIAejUH9u wZZHtioCkZ29raeaopAO75PHyP6hmtRFp6gfjlmHMDnCR2X3Nmm/Yv0jNOf1Ge44HW7W R70Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fBElkur6LZmhvoW3bpkBRdx7KWPV73Vhiu0rYHr4YMM=; b=LqK+31Joqfj3Gw3SMPBroMIH4nkvAssYczA1pku+vBh1vT3bl7Y1ayJakpMjL+znyp nXdjGzvOkKUuGz8T92bipTBeo3KSV7IxxoTEhrElNJupM9UO7Ty/9PZQvJWZXx1WNR4U qKlsXAkjWqX3YLlXi7cy7N0IqnZQh3ESwQ48X80baTVGP2Oe4Cux0VaejBmF9FeLK+Pz dF0x0MptWc8PtdsaQKNSISH6EKcMxGoD8y2oHdlsaWTheyQl+75D+30w0qQs72sYACbB ZPmX0Ym/DbplrsgdeY+gKSUa3vppyrPIcNkyZswNOHW7g+a3Q+XhsPULgtUtK9yiUFp4 oh5Q== X-Gm-Message-State: AOAM5332joWqBfitPAyTJVtkHOkLd6CiGnexzqeW88a9r02ku3n9ivcA r4zCFi84P47g8mkkY3Atn4hnnPXSyTw= X-Google-Smtp-Source: ABdhPJyUu/VSGxC5/rhCARYcznW0EAHO84EUbGEcuDs1Jl0CVRLqJO7xVgp4kBr05k7mWjqyEGzZxw== X-Received: by 2002:a17:90b:3a83:: with SMTP id om3mr9106164pjb.0.1638376478651; Wed, 01 Dec 2021 08:34:38 -0800 (PST) Received: from harshads-520.kir.corp.google.com ([2620:15c:17:10:41a5:fd1:e459:52d9]) by smtp.googlemail.com with ESMTPSA id il13sm2126374pjb.52.2021.12.01.08.34.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Dec 2021 08:34:37 -0800 (PST) From: Harshad Shirwadkar X-Google-Original-From: Harshad Shirwadkar To: linux-ext4@vger.kernel.org Cc: Harshad Shirwadkar , Dan Carpenter Subject: [PATCH] ext4: initialize err_blk before calling __ext4_get_inode_loc Date: Wed, 1 Dec 2021 08:34:21 -0800 Message-Id: <20211201163421.2631661-1-harshads@google.com> X-Mailer: git-send-email 2.34.0.rc2.393.gf8c9666880-goog MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Harshad Shirwadkar 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 --- fs/ext4/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index bfd3545f1e5d..fbdd2dda57ae 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4523,7 +4523,7 @@ static int __ext4_get_inode_loc(struct super_block *sb, unsigned long ino, 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(struct inode *inode, 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,