[PATCH 1/5] maple_tree: Move the check forward to avoid static check warning.
Peng Zhang
zhangpeng.00 at bytedance.com
Thu Nov 9 04:43:04 PST 2023
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.
Reported-by: Dan Carpenter <dan.carpenter at linaro.org>
Closes: http://lists.infradead.org/pipermail/maple-tree/2023-November/003046.html
Signed-off-by: Peng Zhang <zhangpeng.00 at bytedance.com>
---
lib/maple_tree.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index aaba453b0d30..1dfbcb74787a 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -7249,6 +7249,11 @@ static void mas_validate_gaps(struct ma_state *mas)
counted:
if (mt == maple_arange_64) {
+ if (!gaps) {
+ MT_BUG_ON(mas->tree, 1);
+ return;
+ }
+
offset = ma_meta_gap(node, mt);
if (offset > i) {
pr_err("gap offset %p[%u] is invalid\n", node, offset);
@@ -7261,7 +7266,6 @@ static void mas_validate_gaps(struct ma_state *mas)
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",
--
2.20.1
More information about the maple-tree
mailing list