[PATCH] maple_tree: Fix sparse reported issues

Matthew Wilcox willy at infradead.org
Tue Jul 12 07:54:03 PDT 2022


On Tue, Jul 12, 2022 at 02:24:55PM +0000, Liam Howlett wrote:
> When building with C=1, the maple tree had some rcu type mismatch &
> locking mismatches in the destroy functions.  There were cosmetic only
> since this happens after the nodes are removed from the tree.

... in the current use-case.  It's a legitimate use of the API to do:

	ma_init();
	ma_store();
	ma_destroy();
	ma_store();

Can you add a new test that does that?

> @@ -5524,13 +5526,17 @@ static void mt_destroy_walk(struct maple_enode *enode, unsigned char ma_flags,
>  
>  		type = mte_node_type(mas.node);
>  		slots = ma_slots(mte_to_node(mas.node), type);
> -		if ((offset < mt_slots[type]) && mte_node_type(slots[offset]) &&
> -		    mte_to_node(slots[offset])) {
> -			struct maple_enode *parent = mas.node;
> +		if (offset >= mt_slots[type])
> +			goto next;
>  
> -			mas.node = mas_slot_locked(&mas, slots, offset);
> +		tmp = mas_slot_locked(&mas, slots, offset);
> +		if (mte_node_type(tmp) && mte_to_node(tmp)) {
> +

Unnecessary blank line?

> +			parent = mas.node;
> +			mas.node = tmp;
>  			slots = mas_destroy_descend(&mas, parent, offset);
>  		}
> +next:
>  		node = mas_mn(&mas);
>  	} while (start != mas.node);
>  
> -- 
> 2.35.1
> 



More information about the maple-tree mailing list