hppfs: hppfs_read_file() may return -ERROR

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, April 2, 2009 - 10:00 pm

Gitweb:     http://git.kernel.org/linus/880fe76ee6f38eda82e9f3de9a7a206dfd1bab9d
Commit:     880fe76ee6f38eda82e9f3de9a7a206dfd1bab9d
Parent:     695f6ae0dcea3dd83bfbb9634ff067f780649ba8
Author:     Roel Kluin <roel.kluin@gmail.com>
AuthorDate: Thu Apr 2 16:57:18 2009 -0700
Committer:  Linus Torvalds <torvalds@linux-foundation.org>
CommitDate: Thu Apr 2 19:04:53 2009 -0700

    hppfs: hppfs_read_file() may return -ERROR
    
    hppfs_read_file() may return (ssize_t) -ENOMEM, or -EFAULT.  When stored
    in size_t 'count', these errors will not be noticed, a large value will be
    added to *ppos.
    
    Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 fs/hppfs/hppfs.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/fs/hppfs/hppfs.c b/fs/hppfs/hppfs.c
index b278f7f..a5089a6 100644
--- a/fs/hppfs/hppfs.c
+++ b/fs/hppfs/hppfs.c
@@ -280,7 +280,12 @@ static ssize_t hppfs_read(struct file *file, char __user *buf, size_t count,
 			       "errno = %d\n", err);
 			return err;
 		}
-		count = hppfs_read_file(hppfs->host_fd, buf, count);
+		err = hppfs_read_file(hppfs->host_fd, buf, count);
+		if (err < 0) {
+			printk(KERN_ERR "hppfs_read: read failed: %d\n", err);
+			return err;
+		}
+		count = err;
 		if (count > 0)
 			*ppos += count;
 	}
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
hppfs: hppfs_read_file() may return -ERROR, Linux Kernel Mailing ..., (Thu Apr 2, 10:00 pm)