Skip to content

Commit

Permalink
block/partitions/mac.c: obey the state->limit constraint
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Jens Axboe <[email protected]>
Cc: Yasuaki Ishimatsu <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Ming Lei authored and torvalds committed Feb 28, 2013
1 parent 8b8a6e1 commit 06004e6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions block/partitions/mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 06004e6

Please sign in to comment.