aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAnton Altaparmakov <aia21@cantab.net>2005-06-25 11:51:58 -0400
committerAnton Altaparmakov <aia21@cantab.net>2005-06-25 11:51:58 -0400
commit3bd1f4a173a3445f9919c21e775de2d8b9deacf8 (patch)
tree6b32056b5b63d41fc5d032318ed0f94dbc562288 /fs
parentca8fd7a0c6aa835e8014830b290cb965e85ac88e (diff)
NTFS: Fix several occurences of a bug where we would perform 'var & ~const'
with a 64-bit variable and a int, i.e. 32-bit, constant. This causes the higher order 32-bits of the 64-bit variable to be zeroed. To fix this cast the 'const' to the same 64-bit type as 'var'. Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Diffstat (limited to 'fs')
-rw-r--r--fs/ntfs/ChangeLog4
-rw-r--r--fs/ntfs/dir.c3
-rw-r--r--fs/ntfs/inode.h2
-rw-r--r--fs/ntfs/lcnalloc.c4
-rw-r--r--fs/ntfs/logfile.c6
5 files changed, 12 insertions, 7 deletions
diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog
index c089bf0c02ac..a916c8b0697a 100644
--- a/fs/ntfs/ChangeLog
+++ b/fs/ntfs/ChangeLog
@@ -128,6 +128,10 @@ ToDo/Notes:
128 - Detect the case when Windows has been suspended to disk on the volume 128 - Detect the case when Windows has been suspended to disk on the volume
129 to be mounted and if this is the case do not allow (re)mounting 129 to be mounted and if this is the case do not allow (re)mounting
130 read-write. This is done by parsing hiberfil.sys if present. 130 read-write. This is done by parsing hiberfil.sys if present.
131 - Fix several occurences of a bug where we would perform 'var & ~const'
132 with a 64-bit variable and a int, i.e. 32-bit, constant. This causes
133 the higher order 32-bits of the 64-bit variable to be zeroed. To fix
134 this cast the 'const' to the same 64-bit type as 'var'.
131 135
1322.1.22 - Many bug and race fixes and error handling improvements. 1362.1.22 - Many bug and race fixes and error handling improvements.
133 137
diff --git a/fs/ntfs/dir.c b/fs/ntfs/dir.c
index a56ca1821eed..46779471c542 100644
--- a/fs/ntfs/dir.c
+++ b/fs/ntfs/dir.c
@@ -1308,7 +1308,8 @@ find_next_index_buffer:
1308 ntfs_debug("Handling index buffer 0x%llx.", 1308 ntfs_debug("Handling index buffer 0x%llx.",
1309 (unsigned long long)bmp_pos + cur_bmp_pos); 1309 (unsigned long long)bmp_pos + cur_bmp_pos);
1310 /* If the current index buffer is in the same page we reuse the page. */ 1310 /* If the current index buffer is in the same page we reuse the page. */
1311 if ((prev_ia_pos & PAGE_CACHE_MASK) != (ia_pos & PAGE_CACHE_MASK)) { 1311 if ((prev_ia_pos & (s64)PAGE_CACHE_MASK) !=
1312 (ia_pos & (s64)PAGE_CACHE_MASK)) {
1312 prev_ia_pos = ia_pos; 1313 prev_ia_pos = ia_pos;
1313 if (likely(ia_page != NULL)) { 1314 if (likely(ia_page != NULL)) {
1314 unlock_page(ia_page); 1315 unlock_page(ia_page);
diff --git a/fs/ntfs/inode.h b/fs/ntfs/inode.h
index 6eb99777a722..3de5c0231966 100644
--- a/fs/ntfs/inode.h
+++ b/fs/ntfs/inode.h
@@ -110,7 +110,7 @@ struct _ntfs_inode {
110 u8 block_size_bits; /* Log2 of the above. */ 110 u8 block_size_bits; /* Log2 of the above. */
111 u8 vcn_size_bits; /* Log2 of the above. */ 111 u8 vcn_size_bits; /* Log2 of the above. */
112 } index; 112 } index;
113 struct { /* It is a compressed file or an attribute inode. */ 113 struct { /* It is a compressed/sparse file/attribute inode. */
114 s64 size; /* Copy of compressed_size from 114 s64 size; /* Copy of compressed_size from
115 $DATA. */ 115 $DATA. */
116 u32 block_size; /* Size of a compression block 116 u32 block_size; /* Size of a compression block
diff --git a/fs/ntfs/lcnalloc.c b/fs/ntfs/lcnalloc.c
index 7087b5b0e6ce..a4bc07616e5d 100644
--- a/fs/ntfs/lcnalloc.c
+++ b/fs/ntfs/lcnalloc.c
@@ -293,7 +293,7 @@ runlist_element *ntfs_cluster_alloc(ntfs_volume *vol, const VCN start_vcn,
293 buf_size = i_size - last_read_pos; 293 buf_size = i_size - last_read_pos;
294 buf_size <<= 3; 294 buf_size <<= 3;
295 lcn = bmp_pos & 7; 295 lcn = bmp_pos & 7;
296 bmp_pos &= ~7; 296 bmp_pos &= ~(LCN)7;
297 ntfs_debug("Before inner while loop: buf_size %i, lcn 0x%llx, " 297 ntfs_debug("Before inner while loop: buf_size %i, lcn 0x%llx, "
298 "bmp_pos 0x%llx, need_writeback %i.", buf_size, 298 "bmp_pos 0x%llx, need_writeback %i.", buf_size,
299 (unsigned long long)lcn, 299 (unsigned long long)lcn,
@@ -311,7 +311,7 @@ runlist_element *ntfs_cluster_alloc(ntfs_volume *vol, const VCN start_vcn,
311 (unsigned int)*byte); 311 (unsigned int)*byte);
312 /* Skip full bytes. */ 312 /* Skip full bytes. */
313 if (*byte == 0xff) { 313 if (*byte == 0xff) {
314 lcn = (lcn + 8) & ~7; 314 lcn = (lcn + 8) & ~(LCN)7;
315 ntfs_debug("Continuing while loop 1."); 315 ntfs_debug("Continuing while loop 1.");
316 continue; 316 continue;
317 } 317 }
diff --git a/fs/ntfs/logfile.c b/fs/ntfs/logfile.c
index e680dd0cdb64..8edb8e20fb08 100644
--- a/fs/ntfs/logfile.c
+++ b/fs/ntfs/logfile.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * logfile.c - NTFS kernel journal handling. Part of the Linux-NTFS project. 2 * logfile.c - NTFS kernel journal handling. Part of the Linux-NTFS project.
3 * 3 *
4 * Copyright (c) 2002-2004 Anton Altaparmakov 4 * Copyright (c) 2002-2005 Anton Altaparmakov
5 * 5 *
6 * This program/include file is free software; you can redistribute it and/or 6 * This program/include file is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as published 7 * modify it under the terms of the GNU General Public License as published
@@ -410,7 +410,7 @@ err_out:
410} 410}
411 411
412/** 412/**
413 * ntfs_ckeck_logfile - check in the journal if the volume is consistent 413 * ntfs_check_logfile - check the journal for consistency
414 * @log_vi: struct inode of loaded journal $LogFile to check 414 * @log_vi: struct inode of loaded journal $LogFile to check
415 * 415 *
416 * Check the $LogFile journal for consistency and return TRUE if it is 416 * Check the $LogFile journal for consistency and return TRUE if it is
@@ -464,7 +464,7 @@ BOOL ntfs_check_logfile(struct inode *log_vi)
464 * optimize log_page_size and log_page_bits into constants. 464 * optimize log_page_size and log_page_bits into constants.
465 */ 465 */
466 log_page_bits = generic_ffs(log_page_size) - 1; 466 log_page_bits = generic_ffs(log_page_size) - 1;
467 size &= ~(log_page_size - 1); 467 size &= ~(s64)(log_page_size - 1);
468 /* 468 /*
469 * Ensure the log file is big enough to store at least the two restart 469 * Ensure the log file is big enough to store at least the two restart
470 * pages and the minimum number of log record pages. 470 * pages and the minimum number of log record pages.