Staging: hv: return -EINVAL instead of calling ASSERT()
authorBill Pemberton <wfp5p@virginia.edu>
Wed, 5 May 2010 19:27:39 +0000 (15:27 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 11 May 2010 18:36:13 +0000 (11:36 -0700)
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>
drivers/staging/hv/Channel.c

index bd1a33608fcf1ba097b66e5d8ac23a8f77f4ce12..0a9ca336ede944c7bea13dcd73ac701f0cc513c6 100644 (file)
@@ -793,7 +793,8 @@ int VmbusChannelSendPacketPageBuffer(struct vmbus_channel *Channel,
 
        DPRINT_ENTER(VMBUS);
 
-       ASSERT(PageCount <= MAX_PAGE_BUFFER_COUNT);
+       if (PageCount > MAX_PAGE_BUFFER_COUNT)
+               return -EINVAL;
 
        DumpVmbusChannel(Channel);
 
@@ -864,8 +865,8 @@ int VmbusChannelSendPacketMultiPageBuffer(struct vmbus_channel *Channel,
        DPRINT_DBG(VMBUS, "data buffer - offset %u len %u pfn count %u",
                   MultiPageBuffer->Offset, MultiPageBuffer->Length, PfnCount);
 
-       ASSERT(PfnCount > 0);
-       ASSERT(PfnCount <= MAX_MULTIPAGE_BUFFER_COUNT);
+       if ((PfnCount < 0) || (PfnCount > MAX_MULTIPAGE_BUFFER_COUNT))
+               return -EINVAL;
 
        /*
         * Adjust the size down since VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER is