All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Elder <elder@dreamhost.com>
To: ceph-devel@vger.kernel.org
Subject: [PATCH 2/3] rbd: reduce memory used for rbd_dev fields
Date: Tue, 28 Feb 2012 19:52:58 -0800	[thread overview]
Message-ID: <4F4DA11A.4040707@dreamhost.com> (raw)
In-Reply-To: <4F4DA086.7050601@dreamhost.com>

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>
---
  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


  parent reply	other threads:[~2012-02-29  3:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-29  3:50 [PATCH 0/3] rbd: minor cleanups in rbd_add() Alex Elder
2012-02-29  3:52 ` [PATCH 1/3] rbd: have rbd_get_client() return a rbd_client Alex Elder
2012-02-29  3:52 ` Alex Elder [this message]
2012-02-29  3:53 ` [PATCH 3/3] rbd: simplify error handling in rbd_add() Alex Elder
2012-03-02 21:00 ` [PATCH 0/3] rbd: minor cleanups " Sage Weil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F4DA11A.4040707@dreamhost.com \
    --to=elder@dreamhost.com \
    --cc=ceph-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.