diff options
author | Bill Pemberton <wfp5p@virginia.edu> | 2010-05-05 15:27:49 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-11 11:36:14 -0700 |
commit | 3324fb405340cf52fe361697a86d235587402d9c (patch) | |
tree | 5b8ab85cdfb894a8e4ce4352f82260cf7b77f87b /drivers/staging | |
parent | 1bbdd7a5380239533c4bb648c5d5d9510f12974b (diff) |
staging: hv: check return value of RingBufferInit()
RingBufferInit() would always return sucess and instead relied on an
ASSERT() to test for an error condition. Remove the ASSERT() and
return -EINVAL instead. The return value of RingBufferInit() was also
never checked, so check it.
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>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/hv/Channel.c | 13 | ||||
-rw-r--r-- | drivers/staging/hv/RingBuffer.c | 3 |
2 files changed, 13 insertions, 3 deletions
diff --git a/drivers/staging/hv/Channel.c b/drivers/staging/hv/Channel.c index a1431e4ac8be..158f62d8553a 100644 --- a/drivers/staging/hv/Channel.c +++ b/drivers/staging/hv/Channel.c @@ -203,9 +203,18 @@ int VmbusChannelOpen(struct vmbus_channel *NewChannel, u32 SendRingBufferSize, NewChannel->RingBufferPageCount = (SendRingBufferSize + RecvRingBufferSize) >> PAGE_SHIFT; - RingBufferInit(&NewChannel->Outbound, out, SendRingBufferSize); + ret = RingBufferInit(&NewChannel->Outbound, out, SendRingBufferSize); + if (!ret) { + err = ret; + goto errorout; + } + + ret = RingBufferInit(&NewChannel->Inbound, in, RecvRingBufferSize); + if (!ret) { + err = ret; + goto errorout; + } - RingBufferInit(&NewChannel->Inbound, in, RecvRingBufferSize); /* Establish the gpadl for the ring buffer */ DPRINT_DBG(VMBUS, "Establishing ring buffer's gpadl for channel %p...", diff --git a/drivers/staging/hv/RingBuffer.c b/drivers/staging/hv/RingBuffer.c index ee481fd972b7..69f3ebae15a9 100644 --- a/drivers/staging/hv/RingBuffer.c +++ b/drivers/staging/hv/RingBuffer.c @@ -301,7 +301,8 @@ Description: --*/ int RingBufferInit(RING_BUFFER_INFO *RingInfo, void *Buffer, u32 BufferLen) { - ASSERT(sizeof(RING_BUFFER) == PAGE_SIZE); + if (sizeof(RING_BUFFER) != PAGE_SIZE) + return -EINVAL; memset(RingInfo, 0, sizeof(RING_BUFFER_INFO)); |