diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2020-11-19 16:32:31 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-04-16 12:43:21 +0300 |
commit | d99e22c0ea747d6a5b1a06e0787d3643e452c9d0 (patch) | |
tree | 8066fb430fa46c529321b3c42b4ad73ff3c1f135 /lib/xarray.c | |
parent | 9576dd89554e39f1c6dcb377ff2a961269d2eaac (diff) | |
download | linux-d99e22c0ea747d6a5b1a06e0787d3643e452c9d0.tar.xz |
XArray: Fix splitting to non-zero orders
[ Upstream commit 3012110d71f41410932924e1d188f9eb57f1f824 ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'lib/xarray.c')
-rw-r--r-- | lib/xarray.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/xarray.c b/lib/xarray.c index 5fa51614802a..ed775dee1074 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); } |