[pnfs] [PATCH 1/4] [SQUASHME] pnfs: prevent offset overflow in filelayout_pg_test

Benny Halevy bhalevy.lists at gmail.com
Wed May 14 13:37:55 EDT 2008


wb_index needs to be typecasted to (u64) before shifting left
with PAGE_CACHE_SHIFT to prevent overflow on 32-bit architectures
since pgoff_t is unsigned long.

Signed-off-by: Benny Halevy <bhalevy at panasas.com>
---
 fs/nfs/nfs4filelayout.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 4759b44..7ed0843 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -706,8 +706,8 @@ filelayout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
 boundary:
 	if (pgio->pg_boundary == 0)
 		return 1;
-	p_stripe = prev->wb_index << PAGE_CACHE_SHIFT;
-	r_stripe = req->wb_index << PAGE_CACHE_SHIFT;
+	p_stripe = (u64)prev->wb_index << PAGE_CACHE_SHIFT;
+	r_stripe = (u64)req->wb_index << PAGE_CACHE_SHIFT;
 
 #if 0
 	dprintk("%s p %llu r %llu \n", __func__, p_stripe, r_stripe);
-- 
1.5.3.3




More information about the pNFS mailing list