Adds a check about the maximum number of disks.

This commit is contained in:
Andrea Mazzoleni 2013-08-25 22:37:39 +02:00
parent cae50bbeba
commit 6ac6d994a6

View file

@ -735,6 +735,12 @@ static void state_map(struct snapraid_state* state)
++hole;
}
if (hole > 255) {
/* RAID6 P/Q parity works for up to 255 drives, no more */
fprintf(stderr, "Too many disks. No more than 255.\n");
exit(EXIT_FAILURE);
}
/* insert the new mapping */
map = map_alloc(disk->name, hole, "");