aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib/xarray.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-11-08 08:46:49 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2019-11-08 08:46:49 -0800
commit410ef736a77b584e1c54a3784ee56ca63114ce11 (patch)
tree53eb74b71298aee02b9acf8d33a2b82a392948c8 /lib/xarray.c
parentMerge tag 'pm-5.4-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm (diff)
parentidr: Fix idr_alloc_u32 on 32-bit systems (diff)
downloadwireguard-linux-410ef736a77b584e1c54a3784ee56ca63114ce11.tar.xz
wireguard-linux-410ef736a77b584e1c54a3784ee56ca63114ce11.zip
Merge tag 'xarray-5.4' of git://git.infradead.org/users/willy/linux-dax
Pull XArray fixes from Matthew Wilcox: "These all fix various bugs, some of which people have tripped over and some of which have been caught by automatic tools" * tag 'xarray-5.4' of git://git.infradead.org/users/willy/linux-dax: idr: Fix idr_alloc_u32 on 32-bit systems idr: Fix integer overflow in idr_for_each_entry radix tree: Remove radix_tree_iter_find idr: Fix idr_get_next_ul race with idr_remove XArray: Fix xas_next() with a single entry at 0
Diffstat (limited to 'lib/xarray.c')
-rw-r--r--lib/xarray.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/xarray.c b/lib/xarray.c
index 446b956c9188..1237c213f52b 100644
--- a/lib/xarray.c
+++ b/lib/xarray.c
@@ -994,6 +994,8 @@ void *__xas_prev(struct xa_state *xas)
if (!xas_frozen(xas->xa_node))
xas->xa_index--;
+ if (!xas->xa_node)
+ return set_bounds(xas);
if (xas_not_node(xas->xa_node))
return xas_load(xas);
@@ -1031,6 +1033,8 @@ void *__xas_next(struct xa_state *xas)
if (!xas_frozen(xas->xa_node))
xas->xa_index++;
+ if (!xas->xa_node)
+ return set_bounds(xas);
if (xas_not_node(xas->xa_node))
return xas_load(xas);