diff options
author | Peng Zhang <zhangpeng.00@bytedance.com> | 2023-11-20 08:09:33 +0100 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2023-12-12 19:57:00 +0100 |
commit | 2e783f0c1a0d9017209f2ed243960924ebb602cb (patch) | |
tree | f27ee7586ec7f83e567e8946766b78cf146c33b1 /lib/maple_tree.c | |
parent | maple_tree: remove unused function (diff) | |
download | linux-2e783f0c1a0d9017209f2ed243960924ebb602cb.tar.xz linux-2e783f0c1a0d9017209f2ed243960924ebb602cb.zip |
maple_tree: move the check forward to avoid static check warning
Patch series "Some cleanups of maple tree", v2.
These are some small cleanups of maple tree.
This patch (of 5):
Put the check for gap before its reference to avoid Smatch static check
warnings. This is not a bug, it's just a validation program. Even with
this change, Smatch may still generate warnings because MT_BUG_ON()
doesn't necessarily stop the program. It may require fixing Smatch itself
to avoid these warnings.
Link: https://lkml.kernel.org/r/20231120070937.35481-1-zhangpeng.00@bytedance.com
Link: https://lkml.kernel.org/r/20231120070937.35481-2-zhangpeng.00@bytedance.com
Signed-off-by: Peng Zhang <zhangpeng.00@bytedance.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: http://lists.infradead.org/pipermail/maple-tree/2023-November/003046.html
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'lib/maple_tree.c')
-rw-r--r-- | lib/maple_tree.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 3aa69c6920e1..df3ae393f12a 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -7257,6 +7257,7 @@ static void mas_validate_gaps(struct ma_state *mas) counted: if (mt == maple_arange_64) { + MT_BUG_ON(mas->tree, !gaps); offset = ma_meta_gap(node, mt); if (offset > i) { pr_err("gap offset %p[%u] is invalid\n", node, offset); @@ -7269,7 +7270,6 @@ counted: MT_BUG_ON(mas->tree, 1); } - MT_BUG_ON(mas->tree, !gaps); for (i++ ; i < mt_slot_count(mte); i++) { if (gaps[i] != 0) { pr_err("gap %p[%u] beyond node limit != 0\n", |