mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch] slqb: enforce MAX_ORDER
@ 2009-04-26 19:56 David Rientjes
  2009-04-27  7:22 ` Pekka Enberg
  2009-04-28  4:41 ` Nick Piggin
  0 siblings, 2 replies; 3+ messages in thread
From: David Rientjes @ 2009-04-26 19:56 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: Nick Piggin, linux-kernel

Slabs may not be allocated at MAX_ORDER or higher.

Cc: Nick Piggin <npiggin@suse.de>
Signed-off-by: David Rientjes <rientjes@google.com>
---
 mm/slqb.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/slqb.c b/mm/slqb.c
--- a/mm/slqb.c
+++ b/mm/slqb.c
@@ -872,6 +872,7 @@ __setup("slqb_debug", setup_slqb_debug);
 static int __init setup_slqb_min_order(char *str)
 {
 	get_option(&str, &slqb_min_order);
+	slqb_min_order = min(slqb_min_order, MAX_ORDER - 1);
 
 	return 1;
 }
@@ -1840,8 +1841,8 @@ static int calculate_order(int size)
 	 * This size cannot fit in order-1. Allow bigger orders, but
 	 * forget about trying to save space.
 	 */
-	order = slab_order(size, MAX_ORDER, 0);
-	if (order <= MAX_ORDER)
+	order = slab_order(size, MAX_ORDER - 1, 0);
+	if (order < MAX_ORDER)
 		return order;
 
 	return -ENOSYS;

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-04-28  4:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-26 19:56 [patch] slqb: enforce MAX_ORDER David Rientjes
2009-04-27  7:22 ` Pekka Enberg
2009-04-28  4:41 ` Nick Piggin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®