'hint' will be NULL if we're looking up before adding anything
to the IDR.

Signed-off-by: Sasha Levin <[email protected]>
---
 include/linux/idr.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/idr.h b/include/linux/idr.h
index aed2a0c..a6f38b5 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -113,7 +113,7 @@ static inline void *idr_find(struct idr *idr, int id)
 {
        struct idr_layer *hint = rcu_dereference_raw(idr->hint);
 
-       if ((id & ~IDR_MASK) == hint->prefix)
+       if (hint && (id & ~IDR_MASK) == hint->prefix)
                return rcu_dereference_raw(hint->ary[id & IDR_MASK]);
 
        return idr_find_slowpath(idr, id);
-- 
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to