summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2016-09-23 07:44:30 -0800
committerKent Overstreet <kent.overstreet@gmail.com>2016-09-23 16:20:51 -0800
commita157a712e35d23b6787b79af6af5920ab586a38a (patch)
tree178adeb655e596655309135b9b27ee24318511ee
parent9d7e8c3df295a3044901f272351810d7a2e4e5db (diff)
genradix: fix genradix_ptr()
-rw-r--r--lib/generic-radix-tree.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/generic-radix-tree.c b/lib/generic-radix-tree.c
index e443a7b0040e..3f12a4c49abc 100644
--- a/lib/generic-radix-tree.c
+++ b/lib/generic-radix-tree.c
@@ -38,6 +38,9 @@ void *__genradix_ptr(struct __genradix *radix, size_t offset)
size_t level = radix->depth;
struct genradix_node *n = radix->root;
+ if (offset >= genradix_depth_size(radix->depth))
+ return NULL;
+
while (1) {
if (!n)
return NULL;