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

Wei Yang
2020-03-30T12:37:20Z

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 --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);
--
2.23.0