From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chandan Rajendra Subject: [PATCH] ext4: ext4_mb_mark_free_simple: Fix integer value truncation Date: Thu, 3 Nov 2016 14:44:32 +0530 Message-ID: <1478164472-28376-1-git-send-email-chandan@linux.vnet.ibm.com> Cc: jack@suse.cz, Chandan Rajendra , tytso@mit.edu, aneesh.kumar@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org To: linux-ext4@vger.kernel.org Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+glppe-linuxppc-embedded-2=m.gmane.org@lists.ozlabs.org Sender: "Linuxppc-dev" List-Id: linux-ext4.vger.kernel.org 'border' variable is set to a value of 2 times the block size of the underlying filesystem. With 64k block size, the resulting value won't fit into a 16-bit variable. Hence this commit changes the data type of 'border' to 'unsigned int'. Signed-off-by: Chandan Rajendra --- fs/ext4/mballoc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index f418f55..a937ac7 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -669,7 +669,7 @@ static void ext4_mb_mark_free_simple(struct super_block *sb, ext4_grpblk_t min; ext4_grpblk_t max; ext4_grpblk_t chunk; - unsigned short border; + unsigned int border; BUG_ON(len > EXT4_CLUSTERS_PER_GROUP(sb)); -- 2.5.5 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3t8fSb6sbQzDvPd for ; Thu, 3 Nov 2016 20:15:11 +1100 (AEDT) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uA39EDLx110116 for ; Thu, 3 Nov 2016 05:15:09 -0400 Received: from e38.co.us.ibm.com (e38.co.us.ibm.com [32.97.110.159]) by mx0a-001b2d01.pphosted.com with ESMTP id 26fwjv0djp-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 03 Nov 2016 05:15:09 -0400 Received: from localhost by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 3 Nov 2016 03:14:57 -0600 From: Chandan Rajendra To: linux-ext4@vger.kernel.org Cc: Chandan Rajendra , tytso@mit.edu, jack@suse.cz, aneesh.kumar@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org Subject: [PATCH] ext4: ext4_mb_mark_free_simple: Fix integer value truncation Date: Thu, 3 Nov 2016 14:44:32 +0530 Message-Id: <1478164472-28376-1-git-send-email-chandan@linux.vnet.ibm.com> List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 'border' variable is set to a value of 2 times the block size of the underlying filesystem. With 64k block size, the resulting value won't fit into a 16-bit variable. Hence this commit changes the data type of 'border' to 'unsigned int'. Signed-off-by: Chandan Rajendra --- fs/ext4/mballoc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index f418f55..a937ac7 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -669,7 +669,7 @@ static void ext4_mb_mark_free_simple(struct super_block *sb, ext4_grpblk_t min; ext4_grpblk_t max; ext4_grpblk_t chunk; - unsigned short border; + unsigned int border; BUG_ON(len > EXT4_CLUSTERS_PER_GROUP(sb)); -- 2.5.5