OSDN Git Service

radix-tree: Fix UBSAN warning
authorMatthew Wilcox <willy@infradead.org>
Sat, 18 Aug 2018 11:05:50 +0000 (07:05 -0400)
committerMatthew Wilcox <willy@infradead.org>
Wed, 22 Aug 2018 03:49:31 +0000 (23:49 -0400)
commit76f070b4135563165c523ab560056b7a9353e2f2
tree7b4d6288ab637779a59d325f1cc1acaca8b904f9
parentd1c0d5e3c63d61226a75f24d5c35fe20755f0180
radix-tree: Fix UBSAN warning

get_slot_offset() can be called with a NULL 'parent' argument.
In this case, the calculated value will not be used, but calculating
it is undefined.  Rather than fixing the caller (__radix_tree_delete)
to not call get_slot_offset(), make get_slot_offset() robust against
being called with a NULL parent.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
lib/radix-tree.c