From patchwork Tue Oct 11 13:49:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 118983 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 6115FB6F64 for ; Wed, 12 Oct 2011 00:49:35 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750942Ab1JKNtd (ORCPT ); Tue, 11 Oct 2011 09:49:33 -0400 Received: from acsinet15.oracle.com ([141.146.126.227]:54461 "EHLO acsinet15.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750699Ab1JKNtd (ORCPT ); Tue, 11 Oct 2011 09:49:33 -0400 Received: from ucsinet23.oracle.com (ucsinet23.oracle.com [156.151.31.71]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p9BDnSVG008950 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Tue, 11 Oct 2011 13:49:29 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by ucsinet23.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p9BDnRGO008058 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 11 Oct 2011 13:49:27 GMT Received: from abhmt120.oracle.com (abhmt120.oracle.com [141.146.116.72]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p9BDnLTe017831; Tue, 11 Oct 2011 08:49:21 -0500 Received: from elgon.mountain (/41.139.221.94) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 11 Oct 2011 06:49:20 -0700 Date: Tue, 11 Oct 2011 16:49:12 +0300 From: Dan Carpenter To: "Theodore Ts'o" , Yongqiang Yang Cc: Andreas Dilger , linux-ext4@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] ext4: error handling fix in ext4_ext_convert_to_initialized() Message-ID: <20111011134912.GB27127@elgon.mountain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: ucsinet23.oracle.com [156.151.31.71] X-CT-RefId: str=0001.0A090202.4E94496A.0150,ss=1,re=0.000,fgs=0 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org When allocated is unsiged it breaks the error handling at the end of the function when we call: allocated = ext4_split_extent(...); if (allocated < 0) err = allocated; I've made it a signed int instead of unsigned. Signed-off-by: Dan Carpenter --- You guys know I'm not an ext4 expert. I can't swear that the math all works correctly with a signed int. I'm pretty sure it does, but please review this carefully. -- 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/fs/ext4/extents.c b/fs/ext4/extents.c index 57cf568..d65b268 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -2919,7 +2919,8 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, struct ext4_extent zero_ex; struct ext4_extent *ex; ext4_lblk_t ee_block, eof_block; - unsigned int allocated, ee_len, depth; + unsigned int ee_len, depth; + int allocated; int err = 0; int split_flag = 0;