From patchwork Wed Nov 12 03:43:04 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valerie Aurora Henson X-Patchwork-Id: 8294 X-Patchwork-Delegate: tytso@mit.edu 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.176.167]) by ozlabs.org (Postfix) with ESMTP id 7824BDDDDB for ; Wed, 12 Nov 2008 14:44:17 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752071AbYKLDoO (ORCPT ); Tue, 11 Nov 2008 22:44:14 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751468AbYKLDoO (ORCPT ); Tue, 11 Nov 2008 22:44:14 -0500 Received: from mx2.redhat.com ([66.187.237.31]:42471 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752071AbYKLDoA (ORCPT ); Tue, 11 Nov 2008 22:44:00 -0500 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id mAC3i0LB007457 for ; Tue, 11 Nov 2008 22:44:00 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id mAC3hxL1000516; Tue, 11 Nov 2008 22:43:59 -0500 Received: from localhost.localdomain (vpn-6-7.fab.redhat.com [10.33.6.7]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id mAC3hv99014473; Tue, 11 Nov 2008 22:43:58 -0500 Received: from localhost.localdomain (fsbox [127.0.0.1]) by localhost.localdomain (8.14.2/8.14.2) with ESMTP id mAC3hQGC005571; Tue, 11 Nov 2008 19:43:26 -0800 Received: (from val@localhost) by localhost.localdomain (8.14.2/8.14.2/Submit) id mAC3hPr6005570; Tue, 11 Nov 2008 19:43:25 -0800 X-Authentication-Warning: localhost.localdomain: val set sender to vaurora@redhat.com using -f From: Valerie Aurora Henson To: linux-ext4@vger.kernel.org Cc: Valerie Aurora Henson Subject: [RFC PATCH 11/17] Fix overflow in calculation of total file system blocks Date: Tue, 11 Nov 2008 19:43:04 -0800 Message-Id: <1226461390-5502-12-git-send-email-vaurora@redhat.com> In-Reply-To: <1226461390-5502-11-git-send-email-vaurora@redhat.com> References: <1226461390-5502-1-git-send-email-vaurora@redhat.com> <1226461390-5502-2-git-send-email-vaurora@redhat.com> <1226461390-5502-3-git-send-email-vaurora@redhat.com> <1226461390-5502-4-git-send-email-vaurora@redhat.com> <1226461390-5502-5-git-send-email-vaurora@redhat.com> <1226461390-5502-6-git-send-email-vaurora@redhat.com> <1226461390-5502-7-git-send-email-vaurora@redhat.com> <1226461390-5502-8-git-send-email-vaurora@redhat.com> <1226461390-5502-9-git-send-email-vaurora@redhat.com> <1226461390-5502-10-git-send-email-vaurora@redhat.com> <1226461390-5502-11-git-send-email-vaurora@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Blocks per group and group desc count are both 32-bit; multiplied they produce a 32-bit quantity which overflowed. Signed-off-by: Valerie Aurora Henson --- lib/ext2fs/bitmaps.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ext2fs/bitmaps.c b/lib/ext2fs/bitmaps.c index f438a8b..91dc7a1 100644 --- a/lib/ext2fs/bitmaps.c +++ b/lib/ext2fs/bitmaps.c @@ -92,8 +92,8 @@ errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs, start = fs->super->s_first_data_block; end = ext2fs_blocks_count(fs->super)-1; - real_end = (EXT2_BLOCKS_PER_GROUP(fs->super) - * fs->group_desc_count)-1 + start; + real_end = ((__u64) EXT2_BLOCKS_PER_GROUP(fs->super) + * (__u64) fs->group_desc_count)-1 + start; if (fs->flags & EXT2_FLAG_NEW_BITMAPS) return (ext2fs_alloc_generic_bmap(fs,