From: Roel Kluin Date: Thu, 2 Apr 2009 23:57:18 +0000 (-0700) Subject: hppfs: hppfs_read_file() may return -ERROR X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=880fe76ee6f38eda82e9f3de9a7a206dfd1bab9d;p=linux-beck.git 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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/hppfs/hppfs.c b/fs/hppfs/hppfs.c index b278f7f52024..a5089a6dd67a 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; }