From c827f944f51e02894d68f036da843783e622ec2a Mon Sep 17 00:00:00 2001 From: Bill Pemberton Date: Wed, 5 May 2010 15:27:38 -0400 Subject: [PATCH] Staging: hv: remove ASSERT() in Channel.c VmbusChannelOpen() will now return -EINVAL if UserDataLen is too big. Previously this was handled by an assert. Signed-off-by: Bill Pemberton Cc: Hank Janssen Cc: Haiyang Zhang Signed-off-by: Greg Kroah-Hartman --- drivers/staging/hv/Channel.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/staging/hv/Channel.c b/drivers/staging/hv/Channel.c index fdd441174f23..bd1a33608fcf 100644 --- a/drivers/staging/hv/Channel.c +++ b/drivers/staging/hv/Channel.c @@ -258,7 +258,11 @@ int VmbusChannelOpen(struct vmbus_channel *NewChannel, u32 SendRingBufferSize, PAGE_SHIFT; openMsg->ServerContextAreaGpadlHandle = 0; /* TODO */ - ASSERT(UserDataLen <= MAX_USER_DEFINED_BYTES); + if (UserDataLen > MAX_USER_DEFINED_BYTES) { + err = -EINVAL; + goto errorout; + } + if (UserDataLen) memcpy(openMsg->UserData, UserData, UserDataLen); -- 2.20.1