From patchwork Wed Aug 10 19:07:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 109429 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id B59D7B6F8B for ; Thu, 11 Aug 2011 05:07:46 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754680Ab1HJTHo (ORCPT ); Wed, 10 Aug 2011 15:07:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45178 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753890Ab1HJTHo (ORCPT ); Wed, 10 Aug 2011 15:07:44 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p7AJ7gFj011878 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 10 Aug 2011 15:07:42 -0400 Received: from neon.msp.redhat.com (neon.msp.redhat.com [10.15.80.10]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p7AJ7f3Z017935; Wed, 10 Aug 2011 15:07:42 -0400 Message-ID: <4E42D6FD.2020904@redhat.com> Date: Wed, 10 Aug 2011 14:07:41 -0500 From: Eric Sandeen User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc13 Lightning/1.0b3pre Thunderbird/3.1.10 MIME-Version: 1.0 To: Andreas Dilger CC: "Ted Ts'o" , ext4 development Subject: [PATCH] libext2fs: copy cluster_bits in ext2fs_copy_generic_bmap References: <418F4E42-50E6-4CAA-B6F5-CA59B17E84C0@whamcloud.com> In-Reply-To: <418F4E42-50E6-4CAA-B6F5-CA59B17E84C0@whamcloud.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org The f_lotsbad regression test was failing on some systems with: @@ -26,6 +61,7 @@ Restarting e2fsck from the beginning... Pass 1: Checking inodes, blocks, and sizes +Illegal block number passed to ext2fs_test_block_bitmap #0 for in-use block map Pass 2: Checking directory structure Entry 'termcap' in / (2) has deleted/unused inode 12. Clear? yes Running with valgrind (./test_script --valgrind f_lotsbad) we see: +==31409== Conditional jump or move depends on uninitialised value(s) +==31409== at 0x42927A: ext2fs_test_generic_bmap (gen_bitmap64.c:378) among others. Looking at gen_bitmap64.c: 376: arg >>= bitmap->cluster_bits; 377: 378: if ((arg < bitmap->start) || (arg > bitmap->end)) { A little more debugging showed that it was actually bitmap->cluster_bits which was uninitialized, because it never gets copied over in ext2fs_copy_generic_bmap() Patch below resolves the issue. Reported-by: Andreas Dilger Signed-off-by: Eric Sandeen --- -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/lib/ext2fs/gen_bitmap64.c b/lib/ext2fs/gen_bitmap64.c index f75876d..80c9f7a 100644 --- a/lib/ext2fs/gen_bitmap64.c +++ b/lib/ext2fs/gen_bitmap64.c @@ -193,6 +193,7 @@ errcode_t ext2fs_copy_generic_bmap(ext2fs_generic_bitmap src, new_bmap->real_end = src->real_end; new_bmap->bitmap_ops = src->bitmap_ops; new_bmap->base_error_code = src->base_error_code; + new_bmap->cluster_bits = src->cluster_bits; descr = src->description; if (descr) {