Skip to content

Commit

Permalink
ocfs2_dlmfs: Fix math error when reading LVB.
Browse files Browse the repository at this point in the history
When asked for a partial read of the LVB in a dlmfs file, we can
accidentally calculate a negative count.

Reported-by: Dan Carpenter <error27@gmail.com>
Cc: <stable@kernel.org>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
  • Loading branch information
Joel Becker committed Apr 23, 2010
1 parent c21a534 commit a36d515
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/ocfs2/dlmfs/dlmfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ static ssize_t dlmfs_file_read(struct file *filp,
if ((count + *ppos) > i_size_read(inode))
readlen = i_size_read(inode) - *ppos;
else
readlen = count - *ppos;
readlen = count;

lvb_buf = kmalloc(readlen, GFP_NOFS);
if (!lvb_buf)
Expand Down

0 comments on commit a36d515

Please sign in to comment.