ocfs2_dlmfs: Fix math error when reading LVB.

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>
This commit is contained in:
Joel Becker 2010-04-23 15:24:59 -07:00
parent c21a534e2f
commit a36d515c7a

View File

@ -262,7 +262,7 @@ static ssize_t dlmfs_file_read(struct file *filp,
if ((count + *ppos) > i_size_read(inode)) if ((count + *ppos) > i_size_read(inode))
readlen = i_size_read(inode) - *ppos; readlen = i_size_read(inode) - *ppos;
else else
readlen = count - *ppos; readlen = count;
lvb_buf = kmalloc(readlen, GFP_NOFS); lvb_buf = kmalloc(readlen, GFP_NOFS);
if (!lvb_buf) if (!lvb_buf)