All of lore.kernel.org
 help / color / mirror / Atom feed
* [Drbd-dev] [PATCH 1/1] drbd: check return of kmalloc in receive_uuids
@ 2012-10-25  7:00 Jing Wang
  2012-10-29 10:26 ` Philipp Reisner
  0 siblings, 1 reply; 2+ messages in thread
From: Jing Wang @ 2012-10-25  7:00 UTC (permalink / raw)
  To: Lars Ellenberg, drbd-user; +Cc: Jing Wang


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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Drbd-dev] [PATCH 1/1] drbd: check return of kmalloc in receive_uuids
  2012-10-25  7:00 [Drbd-dev] [PATCH 1/1] drbd: check return of kmalloc in receive_uuids Jing Wang
@ 2012-10-29 10:26 ` Philipp Reisner
  0 siblings, 0 replies; 2+ messages in thread
From: Philipp Reisner @ 2012-10-29 10:26 UTC (permalink / raw)
  To: Jing Wang; +Cc: drbd-dev

Hi,

Thanks for pointint this out. I fixed your patch for the drbd-8.3
context and applied it. See:
http://git.drbd.org/gitweb.cgi?p=drbd-8.3.git;a=commit;h=371289b8b632e8b4e364563faa430ff3b6d7d1d9

best,
 Phil

> 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]);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-10-29 10:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-25  7:00 [Drbd-dev] [PATCH 1/1] drbd: check return of kmalloc in receive_uuids Jing Wang
2012-10-29 10:26 ` Philipp Reisner

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.