Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 818cf590 authored by David Rientjes's avatar David Rientjes Committed by Pekka Enberg
Browse files

slub: enforce MAX_ORDER



slub_max_order may not be equal to or greater than MAX_ORDER.

Additionally, if a single object cannot be placed in a slab of
slub_max_order, it still must allocate slabs below MAX_ORDER.

Acked-by: default avatarChristoph Lameter <cl@linux-foundation.org>
Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
Signed-off-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
parent f4efdd65
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1909,7 +1909,7 @@ static inline int calculate_order(int size)
	 * Doh this slab cannot be placed using slub_max_order.
	 */
	order = slab_order(size, 1, MAX_ORDER, 1);
	if (order <= MAX_ORDER)
	if (order < MAX_ORDER)
		return order;
	return -ENOSYS;
}
@@ -2522,6 +2522,7 @@ __setup("slub_min_order=", setup_slub_min_order);
static int __init setup_slub_max_order(char *str)
{
	get_option(&str, &slub_max_order);
	slub_max_order = min(slub_max_order, MAX_ORDER - 1);

	return 1;
}