diff options
author | Anton Altaparmakov <aia21@cantab.net> | 2005-10-04 08:08:53 -0400 |
---|---|---|
committer | Anton Altaparmakov <aia21@cantab.net> | 2005-10-04 08:08:53 -0400 |
commit | c394e458b69632902d65f9e2f39df79314f72908 (patch) | |
tree | 562a5c51f5f87eeb98a39697d5b4c11e2c4c66e3 /fs/ntfs | |
parent | 18efefa9355119b4f6d9b73b074ebbf9882c37c3 (diff) |
NTFS: Fix a 64-bitness bug where a left-shift could overflow a 32-bit variable
which we now cast to 64-bit first (fs/ntfs/mft.c::map_mft_record_page().
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Diffstat (limited to 'fs/ntfs')
-rw-r--r-- | fs/ntfs/layout.h | 2 | ||||
-rw-r--r-- | fs/ntfs/mft.c | 3 | ||||
-rw-r--r-- | fs/ntfs/unistr.c | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/fs/ntfs/layout.h b/fs/ntfs/layout.h index 01f2dfa39cec..5c248d404f05 100644 --- a/fs/ntfs/layout.h +++ b/fs/ntfs/layout.h | |||
@@ -309,7 +309,7 @@ typedef le16 MFT_RECORD_FLAGS; | |||
309 | * Note: The _LE versions will return a CPU endian formatted value! | 309 | * Note: The _LE versions will return a CPU endian formatted value! |
310 | */ | 310 | */ |
311 | #define MFT_REF_MASK_CPU 0x0000ffffffffffffULL | 311 | #define MFT_REF_MASK_CPU 0x0000ffffffffffffULL |
312 | #define MFT_REF_MASK_LE const_cpu_to_le64(0x0000ffffffffffffULL) | 312 | #define MFT_REF_MASK_LE const_cpu_to_le64(MFT_REF_MASK_CPU) |
313 | 313 | ||
314 | typedef u64 MFT_REF; | 314 | typedef u64 MFT_REF; |
315 | typedef le64 leMFT_REF; | 315 | typedef le64 leMFT_REF; |
diff --git a/fs/ntfs/mft.c b/fs/ntfs/mft.c index 247586d1d5dc..b011369b5956 100644 --- a/fs/ntfs/mft.c +++ b/fs/ntfs/mft.c | |||
@@ -58,7 +58,8 @@ static inline MFT_RECORD *map_mft_record_page(ntfs_inode *ni) | |||
58 | * overflowing the unsigned long, but I don't think we would ever get | 58 | * overflowing the unsigned long, but I don't think we would ever get |
59 | * here if the volume was that big... | 59 | * here if the volume was that big... |
60 | */ | 60 | */ |
61 | index = ni->mft_no << vol->mft_record_size_bits >> PAGE_CACHE_SHIFT; | 61 | index = (u64)ni->mft_no << vol->mft_record_size_bits >> |
62 | PAGE_CACHE_SHIFT; | ||
62 | ofs = (ni->mft_no << vol->mft_record_size_bits) & ~PAGE_CACHE_MASK; | 63 | ofs = (ni->mft_no << vol->mft_record_size_bits) & ~PAGE_CACHE_MASK; |
63 | 64 | ||
64 | i_size = i_size_read(mft_vi); | 65 | i_size = i_size_read(mft_vi); |
diff --git a/fs/ntfs/unistr.c b/fs/ntfs/unistr.c index a389a5a16c84..0ea887fc859c 100644 --- a/fs/ntfs/unistr.c +++ b/fs/ntfs/unistr.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * unistr.c - NTFS Unicode string handling. Part of the Linux-NTFS project. | 2 | * unistr.c - NTFS Unicode string handling. Part of the Linux-NTFS project. |
3 | * | 3 | * |
4 | * Copyright (c) 2001-2004 Anton Altaparmakov | 4 | * Copyright (c) 2001-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 |