diff options
-rw-r--r-- | drivers/block/nbd.c | 10 | ||||
-rw-r--r-- | include/linux/nbd.h | 1 |
2 files changed, 4 insertions, 7 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index ae3106045ee5..018753c59b8e 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -54,7 +54,7 @@ static unsigned int debugflags; | |||
54 | #endif /* NDEBUG */ | 54 | #endif /* NDEBUG */ |
55 | 55 | ||
56 | static unsigned int nbds_max = 16; | 56 | static unsigned int nbds_max = 16; |
57 | static struct nbd_device nbd_dev[MAX_NBD]; | 57 | static struct nbd_device *nbd_dev; |
58 | 58 | ||
59 | /* | 59 | /* |
60 | * Use just one lock (or at most 1 per NIC). Two arguments for this: | 60 | * Use just one lock (or at most 1 per NIC). Two arguments for this: |
@@ -649,11 +649,9 @@ static int __init nbd_init(void) | |||
649 | 649 | ||
650 | BUILD_BUG_ON(sizeof(struct nbd_request) != 28); | 650 | BUILD_BUG_ON(sizeof(struct nbd_request) != 28); |
651 | 651 | ||
652 | if (nbds_max > MAX_NBD) { | 652 | nbd_dev = kcalloc(nbds_max, sizeof(*nbd_dev), GFP_KERNEL); |
653 | printk(KERN_CRIT "nbd: cannot allocate more than %u nbds; %u requested.\n", MAX_NBD, | 653 | if (!nbd_dev) |
654 | nbds_max); | 654 | return -ENOMEM; |
655 | return -EINVAL; | ||
656 | } | ||
657 | 655 | ||
658 | for (i = 0; i < nbds_max; i++) { | 656 | for (i = 0; i < nbds_max; i++) { |
659 | struct gendisk *disk = alloc_disk(1); | 657 | struct gendisk *disk = alloc_disk(1); |
diff --git a/include/linux/nbd.h b/include/linux/nbd.h index cc2b47240a8f..986572081e19 100644 --- a/include/linux/nbd.h +++ b/include/linux/nbd.h | |||
@@ -35,7 +35,6 @@ enum { | |||
35 | }; | 35 | }; |
36 | 36 | ||
37 | #define nbd_cmd(req) ((req)->cmd[0]) | 37 | #define nbd_cmd(req) ((req)->cmd[0]) |
38 | #define MAX_NBD 128 | ||
39 | 38 | ||
40 | /* userspace doesn't need the nbd_device structure */ | 39 | /* userspace doesn't need the nbd_device structure */ |
41 | #ifdef __KERNEL__ | 40 | #ifdef __KERNEL__ |