summaryrefslogtreecommitdiffstats
path: root/drivers/block/xen-blkback
diff options
context:
space:
mode:
authorRoger Pau Monne <roger.pau@citrix.com>2013-03-18 17:49:33 +0100
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2013-03-19 08:53:15 -0400
commit217fd5e709f029c125a9d39de5f13387407f131a (patch)
tree0a288b4f23256fda388ccb0528074399320f7477 /drivers/block/xen-blkback
parent29d0b218c87ace1078e08bb32c2e72fc96fa3db3 (diff)
downloadblackbird-op-linux-217fd5e709f029c125a9d39de5f13387407f131a.tar.gz
blackbird-op-linux-217fd5e709f029c125a9d39de5f13387407f131a.zip
xen-blkback: fix foreach_grant_safe to handle empty lists
We may use foreach_grant_safe in the future with empty lists, so make sure we can handle them. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Cc: xen-devel@lists.xen.org Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/block/xen-blkback')
-rw-r--r--drivers/block/xen-blkback/blkback.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index 477a17c20820..2cf8381a1c6e 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -164,7 +164,7 @@ static void make_response(struct xen_blkif *blkif, u64 id,
#define foreach_grant_safe(pos, n, rbtree, node) \
for ((pos) = container_of(rb_first((rbtree)), typeof(*(pos)), node), \
- (n) = rb_next(&(pos)->node); \
+ (n) = (&(pos)->node != NULL) ? rb_next(&(pos)->node) : NULL; \
&(pos)->node != NULL; \
(pos) = container_of(n, typeof(*(pos)), node), \
(n) = (&(pos)->node != NULL) ? rb_next(&(pos)->node) : NULL)
OpenPOWER on IntegriCloud