提交 60571c7d 编写于 作者: A Alex Elder

rbd: reduce memory used for rbd_dev fields

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: NAlex Elder <elder@dreamhost.com>
Signed-off-by: NSage Weil <sage@newdream.net>
上级 d720bcb0
...@@ -2234,11 +2234,11 @@ static ssize_t rbd_add(struct bus_type *bus, ...@@ -2234,11 +2234,11 @@ static ssize_t rbd_add(struct bus_type *bus,
if (!try_module_get(THIS_MODULE)) if (!try_module_get(THIS_MODULE))
return -ENODEV; return -ENODEV;
mon_dev_name = kmalloc(RBD_MAX_OPT_LEN, GFP_KERNEL); mon_dev_name = kmalloc(count, GFP_KERNEL);
if (!mon_dev_name) if (!mon_dev_name)
goto err_out_mod; goto err_out_mod;
options = kmalloc(RBD_MAX_OPT_LEN, GFP_KERNEL); options = kmalloc(count, GFP_KERNEL);
if (!options) if (!options)
goto err_mon_dev; goto err_mon_dev;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册