<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
From: Miklos Szeredi &lt;miklos@szeredi.hu&gt;

This removes check for non-null inode before calling iput(), and uses
iov_length() to calculate number of bytes in iovec.

Signed-off-by: Miklos Szeredi &lt;miklos@szeredi.hu&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
---

 25-akpm/fs/fuse/dev.c |   24 +++++++-----------------
 1 files changed, 7 insertions(+), 17 deletions(-)

diff -puN fs/fuse/dev.c~fuse-device-functions-cleanup fs/fuse/dev.c
--- 25/fs/fuse/dev.c~fuse-device-functions-cleanup	Thu Mar 31 15:08:17 2005
+++ 25-akpm/fs/fuse/dev.c	Thu Mar 31 15:08:17 2005
@@ -416,24 +416,15 @@ struct fuse_copy_state {
 	unsigned len;
 };
 
-static unsigned fuse_copy_init(struct fuse_copy_state *cs, int write,
-			       struct fuse_req *req, const struct iovec *iov,
-			       unsigned long nr_segs)
+static void fuse_copy_init(struct fuse_copy_state *cs, int write,
+			   struct fuse_req *req, const struct iovec *iov,
+			   unsigned long nr_segs)
 {
-	unsigned i;
-	unsigned nbytes;
-
 	memset(cs, 0, sizeof(*cs));
 	cs-&gt;write = write;
 	cs-&gt;req = req;
 	cs-&gt;iov = iov;
 	cs-&gt;nr_segs = nr_segs;
-
-	nbytes = 0;
-	for (i = 0; i &lt; nr_segs; i++)
-		nbytes += iov[i].iov_len;
-
-	return nbytes;
 }
 
 /* Unmap and put previous page of userspace buffer */
@@ -620,7 +611,6 @@ static ssize_t fuse_dev_readv(struct fil
 	struct fuse_req *req;
 	struct fuse_in *in;
 	struct fuse_copy_state cs;
-	unsigned nbytes;
 	unsigned reqsize;
 
 	spin_lock(&amp;fuse_lock);
@@ -642,9 +632,9 @@ static ssize_t fuse_dev_readv(struct fil
 
 	in = &amp;req-&gt;in;
 	reqsize = req-&gt;in.h.len;
-	nbytes = fuse_copy_init(&amp;cs, 1, req, iov, nr_segs);
+	fuse_copy_init(&amp;cs, 1, req, iov, nr_segs);
 	err = -EINVAL;
-	if (nbytes &gt;= reqsize) {
+	if (iov_length(iov, nr_segs) &gt;= reqsize) {
 		err = fuse_copy_one(&amp;cs, &amp;in-&gt;h, sizeof(in-&gt;h));
 		if (!err)
 			err = fuse_copy_args(&amp;cs, in-&gt;numargs, in-&gt;argpages,
@@ -733,7 +723,7 @@ static ssize_t fuse_dev_writev(struct fi
 			       unsigned long nr_segs, loff_t *off)
 {
 	int err;
-	unsigned nbytes;
+	unsigned nbytes = iov_length(iov, nr_segs);
 	struct fuse_req *req;
 	struct fuse_out_header oh;
 	struct fuse_copy_state cs;
@@ -741,7 +731,7 @@ static ssize_t fuse_dev_writev(struct fi
 	if (!fc)
 		return -ENODEV;
 
-	nbytes = fuse_copy_init(&amp;cs, 0, NULL, iov, nr_segs);
+	fuse_copy_init(&amp;cs, 0, NULL, iov, nr_segs);
 	if (nbytes &lt; sizeof(struct fuse_out_header))
 		return -EINVAL;
 
_
</pre></body></html>