[Drbd-dev] [PATCH 1/1] drbd: check return of kmalloc in receive_uuids

Philipp Reisner philipp.reisner at linbit.com
Mon Oct 29 11:26:27 CET 2012


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


More information about the drbd-dev mailing list