return *(unsigned int *)p;
}
+/*
+ * For debugging context when we want to check if the struct slab pointer
+ * appears to be valid.
+ */
+static inline bool validate_slab_ptr(struct slab *slab)
+{
+ return PageSlab(slab_page(slab));
+}
+
#ifdef CONFIG_SLUB_DEBUG
static unsigned long object_map[BITS_TO_LONGS(MAX_OBJS_PER_PAGE)];
static DEFINE_SPINLOCK(object_map_lock);
{
int maxobj;
- if (!folio_test_slab(slab_folio(slab))) {
+ if (!validate_slab_ptr(slab)) {
slab_err(s, slab, "Not a valid slab page");
return 0;
}
return true;
bad:
- if (folio_test_slab(slab_folio(slab))) {
+ if (validate_slab_ptr(slab)) {
/*
* If this is a slab page then lets do the best we can
* to avoid issues in the future. Marking all objects
slab->inuse++;
if (!alloc_debug_processing(s, slab, object, orig_size)) {
- if (folio_test_slab(slab_folio(slab)))
+ if (validate_slab_ptr(slab))
remove_partial(n, slab);
return NULL;
}