summaryrefslogtreecommitdiffstats
path: root/lib/xarray.c
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2020-11-19 08:32:31 -0500
committerMatthew Wilcox (Oracle) <willy@infradead.org>2021-03-30 13:42:33 -0400
commit3012110d71f41410932924e1d188f9eb57f1f824 (patch)
treebdad57981759c2fe3fc329cef4577297ab9a76b8 /lib/xarray.c
parent12efebab09e383bf366bec323bd296b7d90e1c43 (diff)
downloadlinux-3012110d71f41410932924e1d188f9eb57f1f824.tar.gz
linux-3012110d71f41410932924e1d188f9eb57f1f824.tar.bz2
linux-3012110d71f41410932924e1d188f9eb57f1f824.zip
XArray: Fix splitting to non-zero orders
Splitting an order-4 entry into order-2 entries would leave the array containing pointers to 000040008000c000 instead of 000044448888cccc. This is a one-character fix, but enhance the test suite to check this case. Reported-by: Zi Yan <ziy@nvidia.com> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Diffstat (limited to 'lib/xarray.c')
-rw-r--r--lib/xarray.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/xarray.c b/lib/xarray.c
index fb3a0ccebb7e..f5d8f54907b4 100644
--- a/lib/xarray.c
+++ b/lib/xarray.c
@@ -1011,7 +1011,7 @@ void xas_split_alloc(struct xa_state *xas, void *entry, unsigned int order,
do {
unsigned int i;
- void *sibling;
+ void *sibling = NULL;
struct xa_node *node;
node = kmem_cache_alloc(radix_tree_node_cachep, gfp);
@@ -1021,7 +1021,7 @@ void xas_split_alloc(struct xa_state *xas, void *entry, unsigned int order,
for (i = 0; i < XA_CHUNK_SIZE; i++) {
if ((i & mask) == 0) {
RCU_INIT_POINTER(node->slots[i], entry);
- sibling = xa_mk_sibling(0);
+ sibling = xa_mk_sibling(i);
} else {
RCU_INIT_POINTER(node->slots[i], sibling);
}