From 06004e6eebdaf101a0f9b533fac77b5768d2c09c Mon Sep 17 00:00:00 2001 From: Ming Lei Date: Wed, 27 Feb 2013 17:05:18 -0800 Subject: [PATCH] block/partitions/mac.c: obey the state->limit constraint It isn't necessary to read the information of partitions whose number is equal and more than state->limit since only maximum state->limit partitions will be added inside rescan_partitions(). That is also what other kind of partitions are doing. Signed-off-by: Ming Lei Cc: Jens Axboe Cc: Yasuaki Ishimatsu Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- block/partitions/mac.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/partitions/mac.c b/block/partitions/mac.c index 11f688bd76c5..76d8ba6379a9 100644 --- a/block/partitions/mac.c +++ b/block/partitions/mac.c @@ -63,6 +63,10 @@ int mac_partition(struct parsed_partitions *state) put_dev_sector(sect); return 0; } + + if (blocks_in_map >= state->limit) + blocks_in_map = state->limit - 1; + strlcat(state->pp_buf, " [mac]", PAGE_SIZE); for (slot = 1; slot <= blocks_in_map; ++slot) { int pos = slot * secsize;