Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp413039pxb; Wed, 18 Nov 2020 07:41:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJxqBs+XprPHHzgHwMJ0ZB6psQN0+z+TXGO8pwhA4pGFn7zgNYsytMeV2IM9feLYyyOcHeqj X-Received: by 2002:a50:ab15:: with SMTP id s21mr26158136edc.88.1605714069575; Wed, 18 Nov 2020 07:41:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605714069; cv=none; d=google.com; s=arc-20160816; b=zFspFWqhZwLw1JMaaC/eRnMqFn6kRqJ68cVqKaQ2AkDKPvtXMLyjkZwhYo76NrxjAs 6XHvY2Bq5pJJ2dRIN3a5vAdACJn2V02fkxNe4f6xLiOnhn3XKVgn076pwqV6NXB8Fh56 UgWrM9KeBIHLE3vwEKfYk0O4keW3qzDuSX8oPWKvOOnD7KmhKg3WgZksW60Jwk1tM7IC lI0eUmHsObpjIvLcswRv97w0CbVpKqchIxwsWOxaa2z0+4R4yWyIX5hgMs2jEh+HnjfN oO08cOYJakIWrOZDa9Wr9hoHyEOPlGU0FjWzxLpm+/OxTcPpDW72etCHI9Huijz/qtvP m3mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:sender:dkim-signature; bh=/Oov+Vw1l+3Sr5DeUikR0CL8hAZekIvYvpufHts8i7w=; b=mDyWv88CiwQnIOhCtt2o6u/oHQsyphZsqoBOPKS2kMbajTB8rdZ/Yi2DVhA9aMITrz cqfz3ok4iMWsmAnQmaxtM6yhNd8dfmSl7jJZXYU4JjAHqeNbMgO9/44ySUoTT9rpNgSe x9OAjGdMM90j2YhR+DH3cLJ/wy37xr+m0Xj/W8c8ZKH9rnMNxH5wXc8q4dntRU2xpHiD VjaxcHeL+XuN3eLXuffVoisArZZRqh/eFwBrThUEnxJ0y1navwm7QIvp/liUbigMlNcp 9OxYFgpKc7fZRp1EAyHcxxFcHWjMIb3TmPz06XqHusotfbgIR4Fm48xIrZllrksgmlVe IdlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=aM6C83m8; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ml11si16466059ejb.697.2020.11.18.07.40.45; Wed, 18 Nov 2020 07:41:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-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=@google.com header.s=20161025 header.b=aM6C83m8; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727360AbgKRPkg (ORCPT + 99 others); Wed, 18 Nov 2020 10:40:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726624AbgKRPkf (ORCPT ); Wed, 18 Nov 2020 10:40:35 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2C8FC0613D4 for ; Wed, 18 Nov 2020 07:40:35 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id r4so2036886ybs.1 for ; Wed, 18 Nov 2020 07:40:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=/Oov+Vw1l+3Sr5DeUikR0CL8hAZekIvYvpufHts8i7w=; b=aM6C83m8jGQG6S48nmVsHU8svt+eTfMCr4Cs117ZTMQVCC84LlyPTR5MYcxHdh0sf0 EU9V21RI9QjRK6Taevrlc4cpQ81Gfks/KPOQGEn6JpQavjnJfIP5DZHsYBCZLFiLzrX4 xzRnnQV0k7YMhdGXes9Y2vqjOUnG7skkPJC8H/l2/BisBSIVmLTpqcI78TGVYbUVG737 MEqz5ij67Nx7LkHadP9bkPZL3lJ6t0Mxh/yeHDS09TlJj4E/jEDpstFJpBeqwEsGeksz KWvY0Zlamb5Jv5/RllIh7PgzWM4IxxNsrZ0SS6E7sym0RvMA0GiUOz3LwzZnefYZgEPk jlWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=/Oov+Vw1l+3Sr5DeUikR0CL8hAZekIvYvpufHts8i7w=; b=W/1iCXDhFXDeEL6jL9/Wyr88d/p/JzcXKOJi0UrXs7rqe23qkeBu5P9RxU/WXURVlL 1F0moVEPiXwg/svMnI0WdIAL6aI5INnBDrBzMUucK3O8q9XuPzJPCj2lYfp6zA3o8hYn xV0638Vrpza/qUMoyvn1/tKQYuGK4+qdzbYZQvFElTCFI6yyNfC36VF0wjiUbWvUeR9D cjmN9bjpU8owN/0z+5yxTILlkw+LPYiMgVN+lx81t6xZu/axzKYoXIfmwVBxNkPJ/UuO KeniFsocD4b8XvAJi0Vp3gwWCVSxDdWGtJVCu21GQn3ZwaAG7IjethybxqToq5d/kFLQ 83zA== X-Gm-Message-State: AOAM530NdaJIqFWJDe2Z40To6x2tejp3oxPEyN2xVlHgDeopjwiPiLMi Nj88dh8j8m24jmCju19DNo2CaWjSZpP3/UTwJefdfjsEcTs5F1VevhDoJJrkhByutSrZgjZO53v DnjIxnHcXG93XR6KwRHb0lUUwMtIp45obNQX/g/CooWdKLgOKvpyI8Y42RzpPhbQ5o2eoC257J+ /Uq+/r7GM= Sender: "saranyamohan via sendgmr" X-Received: from saranyamohan.svl.corp.google.com ([100.116.76.178]) (user=saranyamohan job=sendgmr) by 2002:a25:2495:: with SMTP id k143mr1216635ybk.396.1605714034844; Wed, 18 Nov 2020 07:40:34 -0800 (PST) Date: Wed, 18 Nov 2020 07:38:51 -0800 In-Reply-To: <20201118153947.3394530-1-saranyamohan@google.com> Message-Id: <20201118153947.3394530-6-saranyamohan@google.com> Mime-Version: 1.0 References: <20201118153947.3394530-1-saranyamohan@google.com> X-Mailer: git-send-email 2.29.2.299.gdc1121823c-goog Subject: [RFC PATCH v3 05/61] e2fsck: add assert when copying context From: Saranya Muruganandam To: linux-ext4@vger.kernel.org, tytso@mit.edu Cc: adilger.kernel@dilger.ca, Li Xi , Wang Shilong , Saranya Muruganandam Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Li Xi Adding the assert would simplify the copying of context. Signed-off-by: Li Xi Signed-off-by: Wang Shilong Signed-off-by: Saranya Muruganandam --- e2fsck/pass1.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index ba513d91..d16bedd3 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -46,6 +46,7 @@ #ifdef HAVE_ERRNO_H #include #endif +#include #include "e2fsck.h" #include @@ -2129,6 +2130,19 @@ static errcode_t e2fsck_pass1_thread_prepare(e2fsck_t global_ctx, e2fsck_t *thre ext2_filsys thread_fs; ext2_filsys global_fs = global_ctx->fs; + assert(global_ctx->inode_used_map == NULL); + assert(global_ctx->inode_dir_map == NULL); + assert(global_ctx->inode_bb_map == NULL); + assert(global_ctx->inode_imagic_map == NULL); + assert(global_ctx->inode_reg_map == NULL); + assert(global_ctx->inodes_to_rebuild == NULL); + + assert(global_ctx->block_found_map == NULL); + assert(global_ctx->block_dup_map == NULL); + assert(global_ctx->block_ea_map == NULL); + assert(global_ctx->block_metadata_map == NULL); + assert(global_ctx->fs->dblist == NULL); + retval = ext2fs_get_mem(sizeof(struct e2fsck_struct), &thread_context); if (retval) { com_err(global_ctx->program_name, retval, "while allocating memory"); -- 2.29.2.299.gdc1121823c-goog