diff options
author | Michael Halcrow <mhalcrow@us.ibm.com> | 2007-10-16 04:28:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:43:12 -0400 |
commit | d6a13c17164fccab8aa96ca435ddacbf428335ca (patch) | |
tree | 8995bb0b5c22a97c8f6c86eff797ff2de0421ee2 /fs/ecryptfs/read_write.c | |
parent | bf12be1cc851cface331b0e74713a6bb1cb046b0 (diff) |
eCryptfs: fix data types
Update data types and add casts in order to avoid potential overflow
issues.
Signed-off-by: Michael Halcrow <mhalcrow@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ecryptfs/read_write.c')
-rw-r--r-- | fs/ecryptfs/read_write.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/ecryptfs/read_write.c b/fs/ecryptfs/read_write.c index ccd2599e0a4f..272eaeb9a738 100644 --- a/fs/ecryptfs/read_write.c +++ b/fs/ecryptfs/read_write.c | |||
@@ -87,7 +87,8 @@ int ecryptfs_write_lower_page_segment(struct inode *ecryptfs_inode, | |||
87 | loff_t offset; | 87 | loff_t offset; |
88 | int rc; | 88 | int rc; |
89 | 89 | ||
90 | offset = (page_for_lower->index << PAGE_CACHE_SHIFT) + offset_in_page; | 90 | offset = ((((off_t)page_for_lower->index) << PAGE_CACHE_SHIFT) |
91 | + offset_in_page); | ||
91 | virt = kmap(page_for_lower); | 92 | virt = kmap(page_for_lower); |
92 | rc = ecryptfs_write_lower(ecryptfs_inode, virt, offset, size); | 93 | rc = ecryptfs_write_lower(ecryptfs_inode, virt, offset, size); |
93 | kunmap(page_for_lower); | 94 | kunmap(page_for_lower); |
@@ -117,7 +118,8 @@ int ecryptfs_write(struct file *ecryptfs_file, char *data, loff_t offset, | |||
117 | { | 118 | { |
118 | struct page *ecryptfs_page; | 119 | struct page *ecryptfs_page; |
119 | char *ecryptfs_page_virt; | 120 | char *ecryptfs_page_virt; |
120 | u64 ecryptfs_file_size = i_size_read(ecryptfs_file->f_dentry->d_inode); | 121 | loff_t ecryptfs_file_size = |
122 | i_size_read(ecryptfs_file->f_dentry->d_inode); | ||
121 | loff_t data_offset = 0; | 123 | loff_t data_offset = 0; |
122 | loff_t pos; | 124 | loff_t pos; |
123 | int rc = 0; | 125 | int rc = 0; |
@@ -277,7 +279,7 @@ int ecryptfs_read_lower_page_segment(struct page *page_for_ecryptfs, | |||
277 | loff_t offset; | 279 | loff_t offset; |
278 | int rc; | 280 | int rc; |
279 | 281 | ||
280 | offset = ((page_index << PAGE_CACHE_SHIFT) + offset_in_page); | 282 | offset = ((((loff_t)page_index) << PAGE_CACHE_SHIFT) + offset_in_page); |
281 | virt = kmap(page_for_ecryptfs); | 283 | virt = kmap(page_for_ecryptfs); |
282 | rc = ecryptfs_read_lower(virt, offset, size, ecryptfs_inode); | 284 | rc = ecryptfs_read_lower(virt, offset, size, ecryptfs_inode); |
283 | kunmap(page_for_ecryptfs); | 285 | kunmap(page_for_ecryptfs); |
@@ -306,7 +308,8 @@ int ecryptfs_read(char *data, loff_t offset, size_t size, | |||
306 | { | 308 | { |
307 | struct page *ecryptfs_page; | 309 | struct page *ecryptfs_page; |
308 | char *ecryptfs_page_virt; | 310 | char *ecryptfs_page_virt; |
309 | u64 ecryptfs_file_size = i_size_read(ecryptfs_file->f_dentry->d_inode); | 311 | loff_t ecryptfs_file_size = |
312 | i_size_read(ecryptfs_file->f_dentry->d_inode); | ||
310 | loff_t data_offset = 0; | 313 | loff_t data_offset = 0; |
311 | loff_t pos; | 314 | loff_t pos; |
312 | int rc = 0; | 315 | int rc = 0; |