diff mbox series

[4/9] XArray: don't expect to have more nr_values than count

Message ID 20200330123643.17120-5-richard.weiyang@gmail.com (mailing list archive)
State New, archived
Headers show
Series XArray: several cleanups | expand

Commit Message

Wei Yang March 30, 2020, 12:36 p.m. UTC
The nr_values is expected to be smaller than count, use a more strict
boundary to do this check.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
 lib/xarray.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/xarray.c b/lib/xarray.c
index 1a092c87fca5..e08a0388a156 100644
--- a/lib/xarray.c
+++ b/lib/xarray.c
@@ -744,7 +744,7 @@  static void update_node(struct xa_state *xas, struct xa_node *node,
 	node->count += count;
 	node->nr_values += values;
 	XA_NODE_BUG_ON(node, node->count > XA_CHUNK_SIZE);
-	XA_NODE_BUG_ON(node, node->nr_values > XA_CHUNK_SIZE);
+	XA_NODE_BUG_ON(node, node->nr_values > node->count);
 	xas_update(xas, node);
 	if (count < 0)
 		xas_delete_node(xas);