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 <[email protected]>
---
 drivers/block/rbd.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index d5b4500..1488a52 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2233,11 +2233,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;

--
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to