From: Joel Becker Date: Fri, 23 Apr 2010 22:24:59 +0000 (-0700) Subject: ocfs2_dlmfs: Fix math error when reading LVB. X-Git-Tag: v2.6.33.4~84 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=fc535314b6f4dc8b400e0bd46bbb42d974d0ff06;p=karo-tx-linux.git ocfs2_dlmfs: Fix math error when reading LVB. commit a36d515c7a2dfacebcf41729f6812dbc424ebcf0 upstream. When asked for a partial read of the LVB in a dlmfs file, we can accidentally calculate a negative count. Reported-by: Dan Carpenter Signed-off-by: Joel Becker Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c index 02bf17808bdc..18bc101d603f 100644 --- a/fs/ocfs2/dlm/dlmfs.c +++ b/fs/ocfs2/dlm/dlmfs.c @@ -205,7 +205,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)