drbd: check return of kmalloc in receive_uuids
Subsystems (2)
PATCH 1/1 drbd: check return of kmalloc in receive_uuids
Signed-off-by Jing Wang <[email protected]>
--- drivers/block/drbd/drbd_receiver.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/block/drbd/drbd_receiver.c +5 -1
@@ -3076,10 +3076,14 @@ static int receive_sizes(struct drbd_conf *mdev, enum drbd_packets cmd, unsignedstatic 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]);
Signature · 1 line
1.7.5.4
Philipp Reisner
maintainerHi,
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
Quoted 25 lines
Signed-off-by Jing Wang <[email protected]>--- drivers/block/drbd/drbd_receiver.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)(quoted diff) +0
-0
b/drivers/block/drbd/drbd_receiver.cindex c74ca2d..4227f38 100644drivers/block/drbd/drbd_receiver.c +0
-0@@ -3076,10 +3076,14 @@ static int receive_sizes(struct drbd_conf *mdev,enum
drbd_packetscmd, unsigned static intreceive_uuids(struct drbd_conf *mdev, enum drbd_packets cmd, unsigned int data_size){drivers/block/drbd/drbd_receiver.c +5
-1struct 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]);