From 6ac6d994a670313e4fb288c7de7aff006480cd7e Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sun, 25 Aug 2013 22:37:39 +0200 Subject: [PATCH] Adds a check about the maximum number of disks. --- state.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/state.c b/state.c index 0feb3067..55ef2418 100644 --- a/state.c +++ b/state.c @@ -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, "");