Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 281304
b: refs/heads/master
c: d3a21c3
h: refs/heads/master
v: v3
  • Loading branch information
Kevin McKinney authored and Greg Kroah-Hartman committed Dec 8, 2011
1 parent f09efa7 commit 55a376f
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 35 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6561f91d68e6f93cba91e64a3b9e0feba8b84fb8
refs/heads/master: d3a21c3c4bbab3d51bde0e4828cb8165d04d6399
75 changes: 41 additions & 34 deletions trunk/drivers/staging/bcm/Bcmchar.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,10 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
(PUINT)temp_buff, Bufflen);
if (bytes > 0) {
Status = STATUS_SUCCESS;
if (copy_to_user(IoBuffer.OutputBuffer, temp_buff, bytes))
Status = -EFAULT;
if (copy_to_user(IoBuffer.OutputBuffer, temp_buff, bytes)) {
kfree(temp_buff);
return -EFAULT;
}
} else {
Status = bytes;
}
Expand Down Expand Up @@ -330,8 +332,10 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)

if (bytes > 0) {
Status = STATUS_SUCCESS;
if (copy_to_user(IoBuffer.OutputBuffer, temp_buff, bytes))
Status = -EFAULT;
if (copy_to_user(IoBuffer.OutputBuffer, temp_buff, bytes)) {
kfree(temp_buff);
return -EFAULT;
}
} else {
Status = bytes;
}
Expand Down Expand Up @@ -625,7 +629,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
if (Status) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
"Failed while copying Content to IOBufer for user space err:%d", Status);
break;
return -EFAULT;
}
}
break;
Expand Down Expand Up @@ -701,7 +705,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
if (Status) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0,
"Failed while copying Content to IOBufer for user space err:%d", Status);
break;
return -EFAULT;
}
}
break;
Expand Down Expand Up @@ -729,9 +733,8 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
return -ENOMEM;

if (copy_from_user(pvBuffer, IoBuffer.InputBuffer, IoBuffer.InputLength)) {
Status = -EFAULT;
kfree(pvBuffer);
break;
return -EFAULT;
}

down(&Adapter->LowPowerModeSync);
Expand Down Expand Up @@ -1012,8 +1015,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
/* Copy Ioctl Buffer structure */
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER))) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "copy_from_user failed..\n");
Status = -EFAULT;
break;
return -EFAULT;
}

if (IoBuffer.OutputLength != sizeof(link_state)) {
Expand All @@ -1028,8 +1030,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)

if (copy_to_user(IoBuffer.OutputBuffer, &link_state, min_t(size_t, sizeof(link_state), IoBuffer.OutputLength))) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Copy_to_user Failed..\n");
Status = -EFAULT;
break;
return -EFAULT;
}
Status = STATUS_SUCCESS;
break;
Expand Down Expand Up @@ -1095,8 +1096,10 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
GetDroppedAppCntrlPktMibs(temp_buff, pTarang);

if (Status != STATUS_FAILURE)
if (copy_to_user(IoBuffer.OutputBuffer, temp_buff, sizeof(S_MIBS_HOST_STATS_MIBS)))
Status = -EFAULT;
if (copy_to_user(IoBuffer.OutputBuffer, temp_buff, sizeof(S_MIBS_HOST_STATS_MIBS))) {
kfree(temp_buff);
return -EFAULT;
}

kfree(temp_buff);
break;
Expand Down Expand Up @@ -1138,8 +1141,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
/* Get WrmBuffer structure */
if (copy_from_user(pvBuffer, IoBuffer.InputBuffer, IoBuffer.InputLength)) {
kfree(pvBuffer);
Status = -EFAULT;
break;
return -EFAULT;
}

pBulkBuffer = (PBULKWRM_BUFFER)pvBuffer;
Expand Down Expand Up @@ -1479,7 +1481,9 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
Status = copy_to_user(OutPutBuff, pReadBuff, ReadBytes);
if (Status) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Copy to use failed with status :%d", Status);
break;
up(&Adapter->NVMRdmWrmLock);
kfree(pReadBuff);
return -EFAULT;
}
NOB = NOB - ReadBytes;
if (NOB) {
Expand Down Expand Up @@ -1571,7 +1575,9 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
Status = copy_from_user(pWriteBuff, InputAddr, WriteBytes);
if (Status) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Copy to user failed with status :%d", Status);
break;
up(&Adapter->NVMRdmWrmLock);
kfree(pWriteBuff);
return -EFAULT;
}
BCM_DEBUG_PRINT_BUFFER(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, pWriteBuff, WriteBytes);

Expand Down Expand Up @@ -1631,8 +1637,10 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)

BcmGetFlash2xSectionalBitMap(Adapter, psFlash2xBitMap);
up(&Adapter->NVMRdmWrmLock);
if (copy_to_user(IoBuffer.OutputBuffer, psFlash2xBitMap, sizeof(FLASH2X_BITMAP)))
Status = -EFAULT;
if (copy_to_user(IoBuffer.OutputBuffer, psFlash2xBitMap, sizeof(FLASH2X_BITMAP))) {
kfree(psFlash2xBitMap);
return -EFAULT;
}

kfree(psFlash2xBitMap);
}
Expand All @@ -1650,13 +1658,13 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
Status = copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER));
if (Status) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Copy of IOCTL BUFFER failed");
return Status;
return -EFAULT;
}

Status = copy_from_user(&eFlash2xSectionVal, IoBuffer.InputBuffer, sizeof(INT));
if (Status) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Copy of flash section val failed");
return Status;
return -EFAULT;
}

down(&Adapter->NVMRdmWrmLock);
Expand Down Expand Up @@ -1700,13 +1708,13 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
Status = copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER));
if (Status) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Copy of IOCTL BUFFER failed Status :%d", Status);
return Status;
return -EFAULT;
}

Status = copy_from_user(&sCopySectStrut, IoBuffer.InputBuffer, sizeof(FLASH2X_COPY_SECTION));
if (Status) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Copy of Copy_Section_Struct failed with Status :%d", Status);
return Status;
return -EFAULT;
}

BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Source SEction :%x", sCopySectStrut.SrcSection);
Expand Down Expand Up @@ -1767,7 +1775,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
Status = copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER));
if (Status) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Copy of IOCTL BUFFER failed");
break;
return -EFAULT;
}

if (Adapter->eNVMType != NVM_FLASH) {
Expand Down Expand Up @@ -1806,12 +1814,12 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
Status = copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER));
if (Status) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Copy of IOCTL BUFFER failed");
return Status;
return -EFAULT;
}
Status = copy_from_user(&eFlash2xSectionVal, IoBuffer.InputBuffer, sizeof(INT));
if (Status) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Copy of flash section val failed");
return Status;
return -EFAULT;
}

BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "Read Section :%d", eFlash2xSectionVal);
Expand Down Expand Up @@ -1853,8 +1861,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
/* Copy Ioctl Buffer structure */
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER))) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "copy_from_user 1 failed\n");
Status = -EFAULT;
break;
return -EFAULT;
}

if (copy_from_user(&stNVMRead, IoBuffer.OutputBuffer, sizeof(NVM_READWRITE)))
Expand Down Expand Up @@ -1909,7 +1916,9 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
Status = copy_to_user(OutPutBuff, pReadBuff, ReadBytes);
if (Status) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Copy to use failed with status :%d", Status);
break;
up(&Adapter->NVMRdmWrmLock);
kfree(pReadBuff);
return -EFAULT;
}
NOB = NOB - ReadBytes;
if (NOB) {
Expand All @@ -1930,8 +1939,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
Status = copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER));
if (Status) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "copy of Ioctl buffer is failed from user space");
Status = -EFAULT;
break;
return -EFAULT;
}

if (IoBuffer.InputLength != sizeof(unsigned long)) {
Expand All @@ -1942,8 +1950,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
Status = copy_from_user(&RxCntrlMsgBitMask, IoBuffer.InputBuffer, IoBuffer.InputLength);
if (Status) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "copy of control bit mask failed from user space");
Status = -EFAULT;
break;
return -EFAULT;
}
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, OSAL_DBG, DBG_LVL_ALL, "\n Got user defined cntrl msg bit mask :%lx", RxCntrlMsgBitMask);
pTarang->RxCntrlMsgBitMask = RxCntrlMsgBitMask;
Expand Down

0 comments on commit 55a376f

Please sign in to comment.