From patchwork Wed Sep 10 21:53:07 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Yanok X-Patchwork-Id: 233 Return-Path: X-Original-To: patchwork@ozlabs.org Delivered-To: patchwork@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id AEF00DEAD1 for ; Thu, 11 Sep 2008 07:54:42 +1000 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org Received: from ocean.emcraft.com (ocean.emcraft.com [213.221.7.182]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id F139DDE258 for ; Thu, 11 Sep 2008 07:54:08 +1000 (EST) Received: from [172.17.0.9] (helo=localhost.localdomain) by ocean.emcraft.com with esmtp (Exim 4.43) id 1KdXd5-0007Kn-Es; Thu, 11 Sep 2008 01:53:42 +0400 From: Ilya Yanok To: linuxppc-dev@ozlabs.org Subject: [PATCH] mm: fix ENTRIES_PER_PAGEPAGE overflow with 256KB pages Date: Thu, 11 Sep 2008 01:53:07 +0400 Message-Id: <1221083587-8091-3-git-send-email-yanok@emcraft.com> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: <1221083587-8091-1-git-send-email-yanok@emcraft.com> References: <1221083587-8091-1-git-send-email-yanok@emcraft.com> X-Spam-Score: -4.3 (----) X-Spam-Report: Spam detection software, running on the system "ocean.emcraft.com", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: ENTRIES_PER_PAGEPAGE define in mm/shmem.c becomes zero if page size is 256KB. This patch fixes this. Signed-off-by: Ilya Yanok --- mm/shmem.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) [...] Content analysis details: (-4.3 points, 2.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.8 ALL_TRUSTED Passed through trusted hosts only via SMTP -2.6 BAYES_00 BODY: Bayesian spam probability is 0 to 1% [score: 0.0000] 0.0 UPPERCASE_25_50 message body is 25-50% uppercase 0.1 AWL AWL: From: address is in the auto white-list Cc: Ilya Yanok , dzu@denx.de, wd@denx.de X-BeenThere: linuxppc-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linuxppc-dev-bounces+patchwork=ozlabs.org@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork=ozlabs.org@ozlabs.org ENTRIES_PER_PAGEPAGE define in mm/shmem.c becomes zero if page size is 256KB. This patch fixes this. Signed-off-by: Ilya Yanok diff --git a/mm/shmem.c b/mm/shmem.c index 04fb4f1..c603427 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -59,7 +59,7 @@ #define TMPFS_MAGIC 0x01021994 #define ENTRIES_PER_PAGE (PAGE_CACHE_SIZE/sizeof(unsigned long)) -#define ENTRIES_PER_PAGEPAGE (ENTRIES_PER_PAGE*ENTRIES_PER_PAGE) +#define ENTRIES_PER_PAGEPAGE ((unsigned long long)ENTRIES_PER_PAGE*ENTRIES_PER_PAGE) #define BLOCKS_PER_PAGE (PAGE_CACHE_SIZE/512) #define SHMEM_MAX_INDEX (SHMEM_NR_DIRECT + (ENTRIES_PER_PAGEPAGE/2) * (ENTRIES_PER_PAGE+1)) @@ -519,7 +519,7 @@ static void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end) struct shmem_inode_info *info = SHMEM_I(inode); unsigned long idx; unsigned long size; - unsigned long limit; + unsigned long long limit; unsigned long stage; unsigned long diroff; struct page **dir; @@ -535,7 +535,7 @@ static void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end) int punch_hole; spinlock_t *needs_lock; spinlock_t *punch_lock; - unsigned long upper_limit; + unsigned long long upper_limit; inode->i_ctime = inode->i_mtime = CURRENT_TIME; idx = (start + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;