rbd: reduce memory used for rbd_dev fields
authorAlex Elder <elder@dreamhost.com>
Thu, 2 Feb 2012 14:13:30 +0000 (08:13 -0600)
committerAlex Elder <elder@dreamhost.com>
Thu, 22 Mar 2012 15:47:48 +0000 (10:47 -0500)
The length of the string containing the monitor address
specification(s) will never exceed the length of the string passed
in to rbd_add().  The same holds true for the ceph + rbd options
string.  So reduce the amount of memory allocated for these to
that length rather than the maximum (1024 bytes).

Signed-off-by: Alex Elder <elder@dreamhost.com>
Signed-off-by: Sage Weil <sage@newdream.net>
drivers/block/rbd.c

index 3e6f300ba9f175d35ae906e5ba80e447d4696940..606d59aece2b6aa18c796785b543b581ed11fa32 100644 (file)
@@ -2234,11 +2234,11 @@ static ssize_t rbd_add(struct bus_type *bus,
        if (!try_module_get(THIS_MODULE))
                return -ENODEV;
 
-       mon_dev_name = kmalloc(RBD_MAX_OPT_LEN, GFP_KERNEL);
+       mon_dev_name = kmalloc(count, GFP_KERNEL);
        if (!mon_dev_name)
                goto err_out_mod;
 
-       options = kmalloc(RBD_MAX_OPT_LEN, GFP_KERNEL);
+       options = kmalloc(count, GFP_KERNEL);
        if (!options)
                goto err_mon_dev;