diff mbox series

[v3,4/4] idr: Add might_alloc() annotation

Message ID 20220906140117.409852-5-michal.winiarski@intel.com (mailing list archive)
State New, archived
Headers show
Series drm: Use full allocated minor range for DRM | expand

Commit Message

Michał Winiarski Sept. 6, 2022, 2:01 p.m. UTC
Using might_alloc() lets us catch problems in a deterministic manner,
even if we end up not allocating anything.

Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
---
 lib/radix-tree.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index 3c78e1e8b2ad..787ab01001de 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -23,6 +23,7 @@ 
 #include <linux/preempt.h>		/* in_interrupt() */
 #include <linux/radix-tree.h>
 #include <linux/rcupdate.h>
+#include <linux/sched/mm.h>
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/xarray.h>
@@ -1481,6 +1482,8 @@  void __rcu **idr_get_free(struct radix_tree_root *root,
 	unsigned long maxindex, start = iter->next_index;
 	unsigned int shift, offset = 0;
 
+	might_alloc(gfp);
+
  grow:
 	shift = radix_tree_load_root(root, &child, &maxindex);
 	if (!radix_tree_tagged(root, IDR_FREE))