Linux NFS development
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 2/5] pnfs/blocklayout: set up layoutupdate_pages properly
Date: Mon, 17 Aug 2015 18:40:58 +0200	[thread overview]
Message-ID: <1439829661-1505-3-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1439829661-1505-1-git-send-email-hch@lst.de>

We need to replace the __be32 with a void pointer to do proper arithmentics
on the virtual addresses so that we can get the right page pointers.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/nfs/blocklayout/extent_tree.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/fs/nfs/blocklayout/extent_tree.c b/fs/nfs/blocklayout/extent_tree.c
index 7536036..a11b759 100644
--- a/fs/nfs/blocklayout/extent_tree.c
+++ b/fs/nfs/blocklayout/extent_tree.c
@@ -558,14 +558,11 @@ retry:
 	arg->layoutupdate_len = ext_tree_layoutupdate_size(count);
 
 	if (unlikely(arg->layoutupdate_pages != &arg->layoutupdate_page)) {
-		__be32 *p = start_p;
+		void *p = start_p, *end = p + arg->layoutupdate_len;
 		int i = 0;
 
-		for (p = start_p;
-		     p < start_p + arg->layoutupdate_len;
-		     p += PAGE_SIZE) {
+		for ( ; p < end; p += PAGE_SIZE)
 			arg->layoutupdate_pages[i++] = vmalloc_to_page(p);
-		}
 	}
 
 	dprintk("%s found %zu ranges\n", __func__, count);
-- 
1.9.1


  parent reply	other threads:[~2015-08-17 16:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-17 16:40 misc blocklayout updates Christoph Hellwig
2015-08-17 16:40 ` [PATCH 1/5] pnfs/blocklayout: calculate layoutupdate size correctly Christoph Hellwig
2015-08-17 16:40 ` Christoph Hellwig [this message]
2015-08-17 16:40 ` [PATCH 3/5] pnfs/blocklayout: reject too long signatures Christoph Hellwig
2015-08-17 16:41 ` [PATCH 4/5] pnfs/blocklayout: pass proper file mode to blkdev_get/put Christoph Hellwig
2015-08-17 16:41 ` [PATCH 5/5] pnfs: move common blocklayout XDR defintions to nfs4.h Christoph Hellwig
2015-08-21  7:04 ` misc blocklayout updates Christoph Hellwig
2015-08-21  7:11   ` Trond Myklebust
2015-08-21  7:15     ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1439829661-1505-3-git-send-email-hch@lst.de \
    --to=hch@lst.de \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@primarydata.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox