diff options
author | Bill Pemberton <wfp5p@virginia.edu> | 2010-05-05 15:27:35 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-11 11:36:13 -0700 |
commit | d1c250bb5df9afb5af3f290d1006dfe601a51e2e (patch) | |
tree | 183c56b90d89a0c3749d4b83425045dea1485e87 | |
parent | c3bf2e26b30f4ea54f3825e8ebda7cb10ec204de (diff) | |
download | linux-d1c250bb5df9afb5af3f290d1006dfe601a51e2e.tar.gz linux-d1c250bb5df9afb5af3f290d1006dfe601a51e2e.tar.bz2 linux-d1c250bb5df9afb5af3f290d1006dfe601a51e2e.zip |
Staging: hv: remove ASSERT() in Channel.c
check memory allocation in VmbusChannelCreateGpadlHeader() and
return -ENOMEM if it fails
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Hank Janssen <hjanssen@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/staging/hv/Channel.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/staging/hv/Channel.c b/drivers/staging/hv/Channel.c index 79c013b48170..2d8c086228cc 100644 --- a/drivers/staging/hv/Channel.c +++ b/drivers/staging/hv/Channel.c @@ -382,6 +382,8 @@ static int VmbusChannelCreateGpadlHeader(void *Kbuffer, u32 Size, sizeof(struct vmbus_channel_gpadl_header) + sizeof(struct gpa_range) + pfnCount * sizeof(u64); msgHeader = kzalloc(msgSize, GFP_KERNEL); + if (!msgHeader) + goto nomem; INIT_LIST_HEAD(&msgHeader->SubMsgList); msgHeader->MessageSize = msgSize; @@ -416,7 +418,9 @@ static int VmbusChannelCreateGpadlHeader(void *Kbuffer, u32 Size, sizeof(struct vmbus_channel_gpadl_body) + pfnCurr * sizeof(u64); msgBody = kzalloc(msgSize, GFP_KERNEL); - ASSERT(msgBody); + /* FIXME: we probably need to more if this fails */ + if (!msgBody) + goto nomem; msgBody->MessageSize = msgSize; (*MessageCount)++; gpadlBody = @@ -459,6 +463,10 @@ static int VmbusChannelCreateGpadlHeader(void *Kbuffer, u32 Size, } return 0; +nomem: + kfree(msgHeader); + kfree(msgBody); + return -ENOMEM; } /* |