mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
XArray: Fix xa_reserve for 2-byte aligned entries
If we reserve index 0, the next entry to be stored there might be 2-byte aligned. That means we have to create the root xa_node at the time of reserving the initial entry. Signed-off-by: Matthew Wilcox <willy@infradead.org>
This commit is contained in:
@@ -767,10 +767,12 @@ void *xas_store(struct xa_state *xas, void *entry)
|
||||
void *first, *next;
|
||||
bool value = xa_is_value(entry);
|
||||
|
||||
if (entry)
|
||||
first = xas_create(xas, !xa_is_node(entry));
|
||||
else
|
||||
if (entry) {
|
||||
bool allow_root = !xa_is_node(entry) && !xa_is_zero(entry);
|
||||
first = xas_create(xas, allow_root);
|
||||
} else {
|
||||
first = xas_load(xas);
|
||||
}
|
||||
|
||||
if (xas_invalid(xas))
|
||||
return first;
|
||||
|
Reference in New Issue
Block a user