Skip to contentSkip to conversation

staging: hv: check kzalloc() result

PATCH Applied Kulikov Vasiliy 1 participant 1 message Jul 16, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 5/15 staging: hv: check kzalloc() result

If kzalloc() fails free allocated resources and exit.

---
 drivers/staging/hv/channel.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/staging/hv/channel.c +2 -0
index f047c5a..78d1aa5 100644
@@ -465,6 +465,8 @@ static int VmbusChannelCreateGpadlHeader(void *Kbuffer, u32 Size,
 			  sizeof(struct vmbus_channel_gpadl_header) +
 			  sizeof(struct gpa_range) + pageCount * sizeof(u64);
 		msgHeader = kzalloc(msgSize, GFP_KERNEL);
+		if (msgHeader = NULL)
+			goto nomem;
 		msgHeader->MessageSize = msgSize;
 
 		gpaHeader = (struct vmbus_channel_gpadl_header *)msgHeader->Msg;
Signature · 1 line
1.7.0.4