From patchwork Tue Feb 23 17:41:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: harshad shirwadkar X-Patchwork-Id: 1443587 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: 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: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=OxhJgNmk; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4DlRGt5Shdz9sSC for ; Wed, 24 Feb 2021 04:43:18 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233723AbhBWRnB (ORCPT ); Tue, 23 Feb 2021 12:43:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230019AbhBWRnA (ORCPT ); Tue, 23 Feb 2021 12:43:00 -0500 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65E70C061786 for ; Tue, 23 Feb 2021 09:42:20 -0800 (PST) Received: by mail-pf1-x436.google.com with SMTP id r5so3286736pfh.13 for ; Tue, 23 Feb 2021 09:42:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OQo1kj2nVSRFSSFkZ42zbMx/gberwXa3UDbaiFT879Q=; b=OxhJgNmkO0nSoeczR3+X5y/16xPmhltRjhVv3b6q+F9t49GPnXezU364jSHJeF5r6G CNFq3MBsNABfzCy1X/iMupTHBB2wDmwNOl+Wk9DAB04BJ93db5Tcne1J0XzRhMpaSrts SN2SaULlSQ7KpY42QDTjCpVEwJZh8xtk0o7toXbqkxZHqd3hoOHHnhes36jj/PAXzjqm aFWqbN3J47W8cxV6HwgR3jv1qR/r7wfQ1Syw0pWLh8tenWW4QKbLshhzcqu7qPoAeXp2 ujQ65UXL37WLTChg2ceaogffBQ1QZLJzc0bwlxxS8I2mZPc7su+uY3TRt1AosYvi1ICl hfBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OQo1kj2nVSRFSSFkZ42zbMx/gberwXa3UDbaiFT879Q=; b=DuYDvNGL2zYDuIJlztp09svawiBHncbSOiRa+w4GXkk8SpVq3EQjsp2Fib+MFKx0NQ m3x8WM5eKpia/lk++xJP/cWK55AojQVMQxNA6h7WqTfrtf2A5sneL/il/+uHf6k4dBmO UJ1zPQBqATtSEbNCCFByb2hTHqE5ZB4/JKRhhRjOR8rw5lBtifEOKBq5PMvsumIf5bdU +tqN3rfbbiRXyQ6Uco4t2OFgFSXzNSzIV+q0DF855z2+Kn66d2AGB2iyc89mobHT005G uh9k5PujK7eRRYgG7UdCnO4TaGOXDKYBFTYvxq95C1MwURi1RGlk0LpqbuU38Y+F3fgM ldxw== X-Gm-Message-State: AOAM5304+ASr51876HBkdOtmBRpqGNAahbdnhf0OQIBamo8v5MOdByjR F3LO8WKuVGJWk9ZfViwgDN2YNp4yzq0= X-Google-Smtp-Source: ABdhPJxicYBICcQ40pc0TrUNQswUqxNX57lWWaBUuWDlx75yUZy3V3E5YOd+kvYNIQE0+FDADZ95ow== X-Received: by 2002:a63:141e:: with SMTP id u30mr8816880pgl.31.1614102139657; Tue, 23 Feb 2021 09:42:19 -0800 (PST) Received: from harshads-520.kir.corp.google.com ([2620:15c:17:10:9c60:903e:f56e:8b80]) by smtp.googlemail.com with ESMTPSA id gk14sm5527408pjb.2.2021.02.23.09.42.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Feb 2021 09:42:17 -0800 (PST) From: Harshad Shirwadkar X-Google-Original-From: Harshad Shirwadkar To: linux-ext4@vger.kernel.org Cc: tytso@mit.edu, Harshad Shirwadkar Subject: [PATCH v2 1/4] e2fsck: don't ignore return values in e2fsck_rewrite_extent_tree Date: Tue, 23 Feb 2021 09:41:53 -0800 Message-Id: <20210223174156.308507-1-harshads@google.com> X-Mailer: git-send-email 2.30.0.617.g56c4b15f3c-goog MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Harshad Shirwadkar Don't ignore return values of library function calls in e2fsck_rewrite_extent_tree. Signed-off-by: Harshad Shirwadkar --- e2fsck/extents.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/e2fsck/extents.c b/e2fsck/extents.c index 600dbc97..018737af 100644 --- a/e2fsck/extents.c +++ b/e2fsck/extents.c @@ -290,8 +290,10 @@ errcode_t e2fsck_rewrite_extent_tree(e2fsck_t ctx, struct extent_list *list) errcode_t err; memset(&inode, 0, sizeof(inode)); - ext2fs_read_inode_full(ctx->fs, list->ino, EXT2_INODE(&inode), - sizeof(inode)); + err = ext2fs_read_inode_full(ctx->fs, list->ino, EXT2_INODE(&inode), + sizeof(inode)); + if (err) + return err; /* Skip deleted inodes and inline data files */ if (inode.i_flags & EXT4_INLINE_DATA_FL) @@ -305,11 +307,11 @@ errcode_t e2fsck_rewrite_extent_tree(e2fsck_t ctx, struct extent_list *list) &blk_count); if (err) return err; - ext2fs_iblk_set(ctx->fs, EXT2_INODE(&inode), blk_count); - ext2fs_write_inode_full(ctx->fs, list->ino, EXT2_INODE(&inode), - sizeof(inode)); - - return 0; + err = ext2fs_iblk_set(ctx->fs, EXT2_INODE(&inode), blk_count); + if (err) + return err; + return ext2fs_write_inode_full(ctx->fs, list->ino, EXT2_INODE(&inode), + sizeof(inode)); } errcode_t e2fsck_read_extents(e2fsck_t ctx, struct extent_list *extents) From patchwork Tue Feb 23 17:41:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: harshad shirwadkar X-Patchwork-Id: 1443588 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: 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: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=fb/dZpVq; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4DlRGx0VMVz9sVF for ; Wed, 24 Feb 2021 04:43:21 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233005AbhBWRnF (ORCPT ); Tue, 23 Feb 2021 12:43:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232594AbhBWRnB (ORCPT ); Tue, 23 Feb 2021 12:43:01 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F70AC06178A for ; Tue, 23 Feb 2021 09:42:21 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id b15so2316920pjb.0 for ; Tue, 23 Feb 2021 09:42:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NJWZzEzNS5vVfW1OyrxYVwHMUBJWStcPfWCrCP2j/8o=; b=fb/dZpVqivMMkxDgtqWl+mPZB+jn/iE6jHXrnS19j75cdTgPBxVUGZAVz8kx9YWjJr i0J0I21c9rZzBuUxJpJgd9asTblD5iyj9grYc661YTXr7N4ggbpfW896S+icxe0WBxIT Km/2gImh+tWIk8+3CnlpWiURcrHe0TFdoaZuGhWWsbifL3Ja6E/m+Wzl83FTBK40oOmm LarfGxImQbosqFjJWtQI2Xa5uxAYl8282RONmkBezi76xTVW+WMWhEWE5Bai7pzRypYS 7ujakUK8y4vcyhTRcxO1QggOWKLC9wyvh+A+CAY/rEkdFadq7p3SUPjq3GCCOptSVRNe P8mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NJWZzEzNS5vVfW1OyrxYVwHMUBJWStcPfWCrCP2j/8o=; b=qYwjJBu0CSl2TqiED94C9s2WSMWVwaJuTPKtrQIo1g4h1rBvP3YKuBX5F0rVV36n7+ 0PjKf8KDFmilX7hOcniILLIRIZciRbTVy0YY68s21i7YI976kTLl4FugurfZkV4cgTxh M5s6vhWy15STMmP1pip5NcsQB1bokKrhiC5sxBuaGJFYbFcI72xKdhv0BINl9G0TvKeE uhss+oUmgk4+/PhSfEddNYzQ71e0zxi7iqcatW1l8qi578/ONMpyP3g9A57tKeEH+Opt VmWrtbcHiVGGVcHqq0UN6ozCXFSJ3QSuvTmj5U2ZCnG9j8ihQVznr5v/oC+s+Cpx7Ijz e2Xw== X-Gm-Message-State: AOAM5336fQWohQrfRY9Ueg8IzB89Bv0nfSK33O8PQAbt2bRPoDClm8Sl Mchr81bJ4HvvQmE+bpUzFRVAiCsm1gc= X-Google-Smtp-Source: ABdhPJyNbpCdfV5kY3F251YkgJ7q0rh+k0G55elb3dcvdqEfn3TWB+1erila1eynJigpYZRXsgTcvA== X-Received: by 2002:a17:902:26f:b029:e3:efab:37a8 with SMTP id 102-20020a170902026fb02900e3efab37a8mr12913750plc.62.1614102140799; Tue, 23 Feb 2021 09:42:20 -0800 (PST) Received: from harshads-520.kir.corp.google.com ([2620:15c:17:10:9c60:903e:f56e:8b80]) by smtp.googlemail.com with ESMTPSA id gk14sm5527408pjb.2.2021.02.23.09.42.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Feb 2021 09:42:19 -0800 (PST) From: Harshad Shirwadkar X-Google-Original-From: Harshad Shirwadkar To: linux-ext4@vger.kernel.org Cc: tytso@mit.edu, Harshad Shirwadkar Subject: [PATCH v2 2/4] ext2fs: don't ignore return value in ext2fs_count_blocks Date: Tue, 23 Feb 2021 09:41:54 -0800 Message-Id: <20210223174156.308507-2-harshads@google.com> X-Mailer: git-send-email 2.30.0.617.g56c4b15f3c-goog In-Reply-To: <20210223174156.308507-1-harshads@google.com> References: <20210223174156.308507-1-harshads@google.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Harshad Shirwadkar Don't ignore return value of ext2fs_get_array() in ext2fs_count_blocks(). Signed-off-by: Harshad Shirwadkar --- lib/ext2fs/extent.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/ext2fs/extent.c b/lib/ext2fs/extent.c index 1a87e68b..9e611038 100644 --- a/lib/ext2fs/extent.c +++ b/lib/ext2fs/extent.c @@ -1824,8 +1824,11 @@ errcode_t ext2fs_count_blocks(ext2_filsys fs, ext2_ino_t ino, if (errcode) goto out; - ext2fs_get_array(handle->max_depth, sizeof(blk64_t), - &intermediate_nodes); + errcode = ext2fs_get_array(handle->max_depth, sizeof(blk64_t), + &intermediate_nodes); + if (errcode) + goto out; + blkcount = handle->level; while (!errcode) { if (extent.e_flags & EXT2_EXTENT_FLAGS_LEAF) { From patchwork Tue Feb 23 17:41:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: harshad shirwadkar X-Patchwork-Id: 1443589 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: 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: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=N54EV6uo; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4DlRGx34Mqz9sVX for ; Wed, 24 Feb 2021 04:43:21 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233036AbhBWRnH (ORCPT ); Tue, 23 Feb 2021 12:43:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230019AbhBWRnD (ORCPT ); Tue, 23 Feb 2021 12:43:03 -0500 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DBA1C06178B for ; Tue, 23 Feb 2021 09:42:23 -0800 (PST) Received: by mail-pf1-x429.google.com with SMTP id c11so9228781pfp.10 for ; Tue, 23 Feb 2021 09:42:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HnzL5gDkqRbD3IsFGdU42evoXK07lViYsNp8FnGdHwo=; b=N54EV6uoywr+Y3NSoNcs5M2+oV6uO/8K4yrEuM+xmVksJjD7eTptk0EL0Y8UIIdodq 9RcRpxoT0Az/4XkXoAFjJ4iETAGdQlv58TWwSZUKTPi0OC1XMp5B5G3dXRd+ZzdYjxIP ceh34W5kW5lWU6aUq3Bjp4cMmf09Iv5j6FEbLll1zk/JFVCLFf3q+k/ae/+Bn9InRXUm zFtLI/lXAQNb0cHz+qsuMePGOH7BlBLN43D74kynwE9JcDyBz1Lfh6kRhObrhXtyHXiV VAWN0S3L1H9JHCwzGCG19ZwPf+uDVN56jeIjr8hgozDYI5dE3baG6ebfbAonqapXBkbP bGfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HnzL5gDkqRbD3IsFGdU42evoXK07lViYsNp8FnGdHwo=; b=EF64K997QO1IFb87aJRFy7hzB+0xCHyCTgdYg559dwodDHEzMT5a38BaLrkSVh5pDt D7rNtq8VvRbhyJZCMeWrFP1vucgBHyhlDVDZQG+sysTH9URDQ0SnPXkVQhOewZUnc9Dp ZPKEM5Bkez+9qD/8MJAfXSjNC/LFgl+FF2knt7+H2GmAYiMl2IsGetgLrlp3/hSFcOWO MTWAk+/WXrncm4BQOePZRvG5mZsgKv7napC3PYIdwcFRGdA5uCoHSFibTLFzG6jE/pPu Jn8SE35A+a03b5AOxglicn2LjS59YRqVnMckm+vpFxEQq7uMetZzJkpos8VxU4r03EBs XnCw== X-Gm-Message-State: AOAM530mAnU9awhbpA34tX1vU0+kmeFOtUn2KEIgaqklxGMjDAIawvQR +/45nl55yziurzlGauhmr0v/AIlgNGE= X-Google-Smtp-Source: ABdhPJxxFzpJvXicDI5eB625u/yCX0fe7GMHyaRLd4EZwP3CuFFYl7Zy5cV2d+Aa+RyU3jeAgUqKRg== X-Received: by 2002:a62:187:0:b029:1da:e323:a96b with SMTP id 129-20020a6201870000b02901dae323a96bmr28465258pfb.28.1614102142568; Tue, 23 Feb 2021 09:42:22 -0800 (PST) Received: from harshads-520.kir.corp.google.com ([2620:15c:17:10:9c60:903e:f56e:8b80]) by smtp.googlemail.com with ESMTPSA id gk14sm5527408pjb.2.2021.02.23.09.42.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Feb 2021 09:42:21 -0800 (PST) From: Harshad Shirwadkar X-Google-Original-From: Harshad Shirwadkar To: linux-ext4@vger.kernel.org Cc: tytso@mit.edu, Harshad Shirwadkar Subject: [PATCH v2 3/4] e2fsck: add fallthrough comment in fc replay switch case Date: Tue, 23 Feb 2021 09:41:55 -0800 Message-Id: <20210223174156.308507-3-harshads@google.com> X-Mailer: git-send-email 2.30.0.617.g56c4b15f3c-goog In-Reply-To: <20210223174156.308507-1-harshads@google.com> References: <20210223174156.308507-1-harshads@google.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Harshad Shirwadkar During fast commit replay scan phase, in ext4_fc_replay_scan(), we want to fallthrough in switch case for EXT4_FC_TAG_ADD_RANGE case. Add a comment for that. Signed-off-by: Harshad Shirwadkar --- e2fsck/journal.c | 1 + 1 file changed, 1 insertion(+) diff --git a/e2fsck/journal.c b/e2fsck/journal.c index 2708942a..a67ef745 100644 --- a/e2fsck/journal.c +++ b/e2fsck/journal.c @@ -325,6 +325,7 @@ static int ext4_fc_replay_scan(journal_t *j, struct buffer_head *bh, ret = JBD2_FC_REPLAY_STOP; else ret = JBD2_FC_REPLAY_CONTINUE; + /* fallthrough */ case EXT4_FC_TAG_DEL_RANGE: case EXT4_FC_TAG_LINK: case EXT4_FC_TAG_UNLINK: From patchwork Tue Feb 23 17:41:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: harshad shirwadkar X-Patchwork-Id: 1443590 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: 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: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=HoyW4bU7; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4DlRGx5fcPz9sVF for ; Wed, 24 Feb 2021 04:43:21 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233065AbhBWRnK (ORCPT ); Tue, 23 Feb 2021 12:43:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232443AbhBWRnE (ORCPT ); Tue, 23 Feb 2021 12:43:04 -0500 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D7D7C061574 for ; Tue, 23 Feb 2021 09:42:24 -0800 (PST) Received: by mail-pg1-x533.google.com with SMTP id n10so12820769pgl.10 for ; Tue, 23 Feb 2021 09:42:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=75c0REdhzMgWGu4NXzfQnu8KSZIrAqpqhx602Q2twFs=; b=HoyW4bU7uDAkZJIvFShPPVu2NzBtapTcVzbyul64LSFy/luXjCzPpi6TSfZAiQBzuJ GXWERaDufEPeZ36zBhi1SgUy5ZeI6ZebcNuGqnFadYTONH/iE3qvYJWO5GratIYfObM4 lbGEvY5BRcVLpbuBYT1VcJoHbm2CfyfK5VkohFkplMX1lceKWGcrs/cG6OZX7u4nbZ/P 4GKILgfacwrBm3Uu4ZX2zcY0Q9KyNl2uWaFHZTR6w15yCsoPsUHB2fDiSwzODCmP4BN0 DVo/DeoVnKAiCOlJD5RwsLj7cmuopJ1GXFEdENuTezOFe3QcooH+HyRD5LzM3pVh7ySb 9wwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=75c0REdhzMgWGu4NXzfQnu8KSZIrAqpqhx602Q2twFs=; b=R5aCsDeff735O11WEnn93xIbdf8MwwYPiQui5HY4Osd+vddKyvzvwBbgTHKRn3hWrT L3tj8rwKLP95A95wereIfFCsbwrmaNiDmo3IxhkCufi/UwnTDnS5Mw0xVQmQGxI/s+67 GyUMnX7Zedg8tHfwYz8YCg4ZMNZMaNWrrEcQz+4R7tD28Qrqwws7q3Qq4+MWfFtwjrpJ k2E+DHlo9DHstxpOGF6cuJ012MSn4Bb8Y4oHk8l8TUhkcwyL3c6inrrlfHILDNH3WRSE z8eqU8Jx1SY8XlrCvUbxEYHqJr2aHWnaATVP4FD28xIC2YUephbibLqNSuBxMwqJmUei 49aQ== X-Gm-Message-State: AOAM530zv9t/JhGVq3Lo2y3A6vCU1UjpY8/sV32a/4YT0P6f7WrKR714 xi8ycTDAMw6SYrvTzLltl9S7IecUsw0= X-Google-Smtp-Source: ABdhPJwDdHxaOvzbu8ZEiD2a1Dv/X+Ko76vuYUe8sZBACjnC1rG4vcV8tWGV3rPGSpp3Ys6oJOuECA== X-Received: by 2002:a65:5843:: with SMTP id s3mr8992998pgr.425.1614102143597; Tue, 23 Feb 2021 09:42:23 -0800 (PST) Received: from harshads-520.kir.corp.google.com ([2620:15c:17:10:9c60:903e:f56e:8b80]) by smtp.googlemail.com with ESMTPSA id gk14sm5527408pjb.2.2021.02.23.09.42.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Feb 2021 09:42:22 -0800 (PST) From: Harshad Shirwadkar X-Google-Original-From: Harshad Shirwadkar To: linux-ext4@vger.kernel.org Cc: tytso@mit.edu, Harshad Shirwadkar Subject: [PATCH v2 4/4] e2fsck: initialize variable before first use in fast commit replay Date: Tue, 23 Feb 2021 09:41:56 -0800 Message-Id: <20210223174156.308507-4-harshads@google.com> X-Mailer: git-send-email 2.30.0.617.g56c4b15f3c-goog In-Reply-To: <20210223174156.308507-1-harshads@google.com> References: <20210223174156.308507-1-harshads@google.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Harshad Shirwadkar Initialize ext2fs_ex variable in ext4_fc_replay_scan() before first use. Also ensure make ext2fs_decode_extent completely overwrite the extent structure passed to it as argument to prevent potential future bugs for the users of the function. Signed-off-by: Harshad Shirwadkar --- e2fsck/journal.c | 2 +- lib/ext2fs/extent.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/e2fsck/journal.c b/e2fsck/journal.c index a67ef745..8e7ba819 100644 --- a/e2fsck/journal.c +++ b/e2fsck/journal.c @@ -289,7 +289,7 @@ static int ext4_fc_replay_scan(journal_t *j, struct buffer_head *bh, struct ext4_fc_tail *tail; __u8 *start, *end; struct ext4_fc_head *head; - struct ext2fs_extent ext2fs_ex; + struct ext2fs_extent ext2fs_ex = {0}; state = &ctx->fc_replay_state; diff --git a/lib/ext2fs/extent.c b/lib/ext2fs/extent.c index 9e611038..b324c7b0 100644 --- a/lib/ext2fs/extent.c +++ b/lib/ext2fs/extent.c @@ -1797,7 +1797,7 @@ errcode_t ext2fs_decode_extent(struct ext2fs_extent *to, void *addr, int len) << 32); to->e_lblk = ext2fs_le32_to_cpu(from->ee_block); to->e_len = ext2fs_le16_to_cpu(from->ee_len); - to->e_flags |= EXT2_EXTENT_FLAGS_LEAF; + to->e_flags = EXT2_EXTENT_FLAGS_LEAF; if (to->e_len > EXT_INIT_MAX_LEN) { to->e_len -= EXT_INIT_MAX_LEN; to->e_flags |= EXT2_EXTENT_FLAGS_UNINIT;