Skip to content

Commit

Permalink
NTFS: Fix a potential overflow by casting (index + 1) to s64 before d…
Browse files Browse the repository at this point in the history
…oing a

      left shift using PAGE_CACHE_SHIFT in fs/ntfs/file.c.  Thanks to Andrew
      Morton pointing this out to.

Signed-off-by: Anton Altaparmakov <[email protected]>
  • Loading branch information
AntonAltaparmakov committed Nov 24, 2005
1 parent 33bc227 commit 3c6af7f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/ntfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ static int ntfs_attr_extend_initialized(ntfs_inode *ni, const s64 new_init_size,
* enough to make ntfs_writepage() work.
*/
write_lock_irqsave(&ni->size_lock, flags);
ni->initialized_size = (index + 1) << PAGE_CACHE_SHIFT;
ni->initialized_size = (s64)(index + 1) << PAGE_CACHE_SHIFT;
if (ni->initialized_size > new_init_size)
ni->initialized_size = new_init_size;
write_unlock_irqrestore(&ni->size_lock, flags);
Expand Down

0 comments on commit 3c6af7f

Please sign in to comment.