* Added some checks on parameters passed

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22981 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Salvatore Benedetto 2007-11-23 12:01:43 +00:00
parent 6dfeac892b
commit e1070961a3
1 changed files with 16 additions and 1 deletions

View File

@ -132,6 +132,9 @@ status_t
InterruptPipe::QueueInterrupt(void *data, size_t dataLength,
usb_callback_func callback, void *callbackCookie)
{
if (dataLength > 0 && data == NULL)
return B_BAD_VALUE;
Transfer *transfer = new(std::nothrow) Transfer(this);
if (!transfer)
return B_NO_MEMORY;
@ -161,6 +164,9 @@ status_t
BulkPipe::QueueBulk(void *data, size_t dataLength, usb_callback_func callback,
void *callbackCookie)
{
if (dataLength > 0 && data == NULL)
return B_BAD_VALUE;
Transfer *transfer = new(std::nothrow) Transfer(this);
if (!transfer)
return B_NO_MEMORY;
@ -179,6 +185,9 @@ status_t
BulkPipe::QueueBulkV(iovec *vector, size_t vectorCount,
usb_callback_func callback, void *callbackCookie)
{
if (vectorCount > 0 && vector == NULL)
return B_BAD_VALUE;
Transfer *transfer = new(std::nothrow) Transfer(this);
if (!transfer)
return B_NO_MEMORY;
@ -213,7 +222,10 @@ IsochronousPipe::QueueIsochronous(void *data, size_t dataLength,
uint32 *startingFrameNumber, uint32 flags, usb_callback_func callback,
void *callbackCookie)
{
// TODO: Check if values of input parameters are set correctely
if ((dataLength > 0 && data == NULL)
|| (packetCount > 0 && packetDesc == NULL))
return B_BAD_VALUE;
usb_isochronous_data *isochronousData
= new(std::nothrow) usb_isochronous_data;
@ -354,6 +366,9 @@ ControlPipe::QueueRequest(uint8 requestType, uint8 request, uint16 value,
uint16 index, uint16 length, void *data, size_t dataLength,
usb_callback_func callback, void *callbackCookie)
{
if (dataLength > 0 && data == NULL)
return B_BAD_VALUE;
usb_request_data *requestData = new(std::nothrow) usb_request_data;
if (!requestData)
return B_NO_MEMORY;