beceem: fix character device ioctl

Sparse caught several places where ioctl interface was incorrectly using user
memory. Fix all the ioctl cases for casting and __user annotation.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
This commit is contained in:
Stephen Hemminger 2010-11-01 09:26:47 -04:00
parent c5ebe2278b
commit ada692b09f
5 changed files with 291 additions and 561 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,7 +0,0 @@
#ifndef _HOST_MIBS_H
#define _HOST_MIBS_H
INT ProcessGetHostMibs(PMINI_ADAPTER Adapter,
PVOID ioBuffer,
ULONG inputBufferLength);
#endif

View file

@ -108,10 +108,8 @@ void SendIdleModeResponse(PMINI_ADAPTER Adapter);
void HandleShutDownModeRequest(PMINI_ADAPTER Adapter,PUCHAR pucBuffer);
int ProcessGetHostMibs(PMINI_ADAPTER Adapter, PVOID ioBuffer,
ULONG inputBufferLength);
int GetDroppedAppCntrlPktMibs(PVOID ioBuffer, PPER_TARANG_DATA pTarang);
int ProcessGetHostMibs(PMINI_ADAPTER Adapter, S_MIBS_HOST_STATS_MIBS *buf);
void GetDroppedAppCntrlPktMibs(S_MIBS_HOST_STATS_MIBS *ioBuffer, PPER_TARANG_DATA pTarang);
void beceem_parse_target_struct(PMINI_ADAPTER Adapter);
void doPowerAutoCorrection(PMINI_ADAPTER psAdapter);

View file

@ -56,7 +56,6 @@
#include "CmHost.h"
#include "DDRInit.h"
#include "Debug.h"
#include "HostMibs.h"
#include "IPv6ProtocolHdr.h"
#include "PHSModule.h"
#include "Protocol.h"

View file

@ -10,12 +10,8 @@
*/
#include "headers.h"
INT ProcessGetHostMibs(PMINI_ADAPTER Adapter,
PVOID ioBuffer,
ULONG inputBufferLength)
INT ProcessGetHostMibs(PMINI_ADAPTER Adapter, S_MIBS_HOST_STATS_MIBS *pstHostMibs)
{
S_MIBS_HOST_STATS_MIBS *pstHostMibs = NULL;
S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL;
S_PHS_RULE *pstPhsRule = NULL;
S_CLASSIFIER_TABLE *pstClassifierTable = NULL;
@ -30,15 +26,6 @@ INT ProcessGetHostMibs(PMINI_ADAPTER Adapter,
return STATUS_FAILURE;
}
if(ioBuffer == NULL)
{
return -EINVAL;
}
memset(ioBuffer,0,sizeof(S_MIBS_HOST_STATS_MIBS));
pstHostMibs = (S_MIBS_HOST_STATS_MIBS *)ioBuffer;
//Copy the classifier Table
for(nClassifierIndex=0; nClassifierIndex < MAX_CLASSIFIERS;
nClassifierIndex++)
@ -115,13 +102,10 @@ INT ProcessGetHostMibs(PMINI_ADAPTER Adapter,
}
INT GetDroppedAppCntrlPktMibs(PVOID ioBuffer, PPER_TARANG_DATA pTarang)
VOID GetDroppedAppCntrlPktMibs(S_MIBS_HOST_STATS_MIBS *pstHostMibs, const PPER_TARANG_DATA pTarang)
{
S_MIBS_HOST_STATS_MIBS *pstHostMibs = (S_MIBS_HOST_STATS_MIBS *)ioBuffer;
memcpy((PVOID)&(pstHostMibs->stDroppedAppCntrlMsgs),(PVOID)&(pTarang->stDroppedAppCntrlMsgs),sizeof(S_MIBS_DROPPED_APP_CNTRL_MESSAGES));
return STATUS_SUCCESS ;
memcpy(&(pstHostMibs->stDroppedAppCntrlMsgs),
&(pTarang->stDroppedAppCntrlMsgs),sizeof(S_MIBS_DROPPED_APP_CNTRL_MESSAGES));
}