From: Jing Wang <windsdaemon@gmail.com>
To: Lars Ellenberg <drbd-dev@lists.linbit.com>, drbd-user@lists.linbit.com
Cc: Jing Wang <windsdaemon@gmail.com>
Subject: [Drbd-dev] [PATCH 1/1] drbd: check return of kmalloc in receive_uuids
Date: Thu, 25 Oct 2012 15:00:56 +0800 [thread overview]
Message-ID: <1351148456-11129-1-git-send-email-windsdaemon@gmail.com> (raw)
Signed-off-by: Jing Wang <windsdaemon@gmail.com>
---
drivers/block/drbd/drbd_receiver.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index c74ca2d..4227f38 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -3076,10 +3076,14 @@ static int receive_sizes(struct drbd_conf *mdev, enum drbd_packets cmd, unsigned
static int receive_uuids(struct drbd_conf *mdev, enum drbd_packets cmd, unsigned int data_size)
{
struct p_uuids *p = &mdev->data.rbuf.uuids;
- u64 *p_uuid;
+ u64 *p_uuid = NULL;
int i, updated_uuids = 0;
p_uuid = kmalloc(sizeof(u64)*UI_EXTENDED_SIZE, GFP_NOIO);
+ if (!p_uuid) {
+ dev_err(DEV, "kmalloc of p_uuid failed\n");
+ return -ENOMEM;
+ }
for (i = UI_CURRENT; i < UI_EXTENDED_SIZE; i++)
p_uuid[i] = be64_to_cpu(p->uuid[i]);
--
1.7.5.4
next reply other threads:[~2012-10-27 9:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-25 7:00 Jing Wang [this message]
2012-10-29 10:26 ` [Drbd-dev] [PATCH 1/1] drbd: check return of kmalloc in receive_uuids Philipp Reisner
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=1351148456-11129-1-git-send-email-windsdaemon@gmail.com \
--to=windsdaemon@gmail.com \
--cc=drbd-dev@lists.linbit.com \
--cc=drbd-user@lists.linbit.com \
/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.