mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
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>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user