Skip to content

Commit

Permalink
xen-blkback: fix foreach_grant_safe to handle empty lists
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Roger Pau Monne authored and Konrad Rzeszutek Wilk committed Mar 19, 2013
1 parent 29d0b21 commit 217fd5e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/block/xen-blkback/blkback.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 217fd5e

Please sign in to comment.