* [PATCH 0/1] staging: wilc1000: need feedback about a patch
@ 2015-08-17 16:55 Raphaël Beamonte
2015-08-17 16:55 ` [PATCH 1/1] staging: wilc1000: replace addresses variables type from u32 to size_t for x64 systems Raphaël Beamonte
2015-08-17 19:55 ` [PATCH 0/1] staging: wilc1000: need feedback about a patch Greg Kroah-Hartman
0 siblings, 2 replies; 5+ messages in thread
From: Raphaël Beamonte @ 2015-08-17 16:55 UTC (permalink / raw)
To: kernelnewbies
Hello there,
I just started patching some drivers to familiarize myself better
with the kernel and perhaps contribute more to it if I find things
that I can actually handle! (hoping I'll be able to handle more and
more throughout time).
Doing so, I found out that in the wilc1000 (staging) driver, I got
compiler warnings for casts from u32 variables to pointers and
pointers to u32 variables. Of course, as my system is 64 bits, the
pointers are stored on that format, while u32 is stored on only
32 bits, making this cast insecure. Replacing the u32 variables by
size_t ones corrects this behavior, as size_t is stored on 32 bits
for 32 bits systems and 64 bits for 64 bits systems. But I'm
wondering if doing so breaks everything here? I mean, why use u32
instead of int at first if 32 bits wasn't needed? Also, there is
a variable named u32address, which clearly states that u32 was
researched here.
So, you'll find following this email the patch I made for the file
host_interface.c which was reporting these warnings a lot. I'd like
to get some advice on that patch: is it a good idea to do that? If
so, can I improve it? If no, what can I do differently to correct
those warnings? I'm here to learn, all feedbacks are welcome!
Once everything is figured out on how to correct that, I'll be happy
to apply that correction to the other files of the modules that
still report that warning!
Thanks,
Rapha?l
Rapha?l Beamonte (1):
staging: wilc1000: replace addresses variables type from u32 to size_t
for x64 systems
drivers/staging/wilc1000/coreconfigurator.c | 2 +-
drivers/staging/wilc1000/coreconfigurator.h | 2 +-
drivers/staging/wilc1000/host_interface.c | 126 ++++++++++++++--------------
drivers/staging/wilc1000/host_interface.h | 2 +-
4 files changed, 66 insertions(+), 66 deletions(-)
--
2.1.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/1] staging: wilc1000: replace addresses variables type from u32 to size_t for x64 systems
2015-08-17 16:55 [PATCH 0/1] staging: wilc1000: need feedback about a patch Raphaël Beamonte
@ 2015-08-17 16:55 ` Raphaël Beamonte
[not found] ` <14628.1439831571@turing-police.cc.vt.edu>
2015-08-17 19:55 ` [PATCH 0/1] staging: wilc1000: need feedback about a patch Greg Kroah-Hartman
1 sibling, 1 reply; 5+ messages in thread
From: Raphaël Beamonte @ 2015-08-17 16:55 UTC (permalink / raw)
To: kernelnewbies
On x64, moving from pointers to u32 variables raises a compiler
warning as u32 variables are stored on 32 bits while pointers
are stored on 64 bits. Using size_t solve this problem as size_t
is stored on 32 or 64 bits depending on the system.
Signed-off-by: Rapha?l Beamonte <raphael.beamonte@gmail.com>
---
drivers/staging/wilc1000/coreconfigurator.c | 2 +-
drivers/staging/wilc1000/coreconfigurator.h | 2 +-
drivers/staging/wilc1000/host_interface.c | 126 ++++++++++++++--------------
drivers/staging/wilc1000/host_interface.h | 2 +-
4 files changed, 66 insertions(+), 66 deletions(-)
diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index c81c41d..f9ddf2a 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -1983,7 +1983,7 @@ extern wilc_wlan_oup_t *gpstrWlanOps;
* @version 1.0
*/
s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,
- u32 u32WIDsCount, bool bRespRequired, u32 drvHandler)
+ u32 u32WIDsCount, bool bRespRequired, size_t drvHandler)
{
s32 counter = 0, ret = 0;
if (gpstrWlanOps == NULL) {
diff --git a/drivers/staging/wilc1000/coreconfigurator.h b/drivers/staging/wilc1000/coreconfigurator.h
index 3af1935..35b62e6 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -167,7 +167,7 @@ s32 CoreConfiguratorInit(void);
s32 CoreConfiguratorDeInit(void);
s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,
- u32 u32WIDsCount, bool bRespRequired, u32 drvHandler);
+ u32 u32WIDsCount, bool bRespRequired, size_t drvHandler);
s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo);
s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo);
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 53c4ca9..c4b86fc 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -616,7 +616,7 @@ static s32 Handle_SetChannel(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetChan *pst
PRINT_D(HOSTINF_DBG, "Setting channel\n");
/*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
if (s32Error) {
PRINT_ER("Failed to set channel\n");
WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE);
@@ -653,10 +653,10 @@ static s32 Handle_SetWfiDrvHandler(tstrHostIfSetDrvHandler *pstrHostIfSetDrvHand
/*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
- if ((pstrHostIfSetDrvHandler->u32Address) == (u32)NULL)
+ if ((pstrHostIfSetDrvHandler->u32Address) == (size_t)NULL)
up(&hSemDeinitDrvHandle);
@@ -698,10 +698,10 @@ static s32 Handle_SetOperationMode(tstrWILC_WFIDrv *drvHandler, tstrHostIfSetOpe
/*Sending Cfg*/
PRINT_INFO(HOSTINF_DBG, "pstrWFIDrv= %p\n", pstrWFIDrv);
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
- if ((pstrHostIfSetOperationMode->u32Mode) == (u32)NULL)
+ if ((pstrHostIfSetOperationMode->u32Mode) == (size_t)NULL)
up(&hSemDeinitDrvHandle);
@@ -747,7 +747,7 @@ s32 Handle_set_IPAddress(tstrWILC_WFIDrv *drvHandler, u8 *pu8IPAddr, u8 idx)
strWID.ps8WidVal = (u8 *)pu8IPAddr;
strWID.s32ValueSize = IP_ALEN;
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
@@ -791,7 +791,7 @@ s32 Handle_get_IPAddress(tstrWILC_WFIDrv *drvHandler, u8 *pu8IPAddr, u8 idx)
strWID.ps8WidVal = (u8 *)WILC_MALLOC(IP_ALEN);
strWID.s32ValueSize = IP_ALEN;
- s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
PRINT_INFO(HOSTINF_DBG, "%pI4\n", strWID.ps8WidVal);
@@ -852,7 +852,7 @@ static s32 Handle_SetMacAddress(tstrWILC_WFIDrv *drvHandler, tstrHostIfSetMacAdd
strWID.s32ValueSize = ETH_ALEN;
PRINT_D(GENERIC_DBG, "mac addr = :%x:%x:%x:%x:%x:%x\n", strWID.ps8WidVal[0], strWID.ps8WidVal[1], strWID.ps8WidVal[2], strWID.ps8WidVal[3], strWID.ps8WidVal[4], strWID.ps8WidVal[5]);
/*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
if (s32Error) {
PRINT_ER("Failed to set mac address\n");
WILC_ERRORREPORT(s32Error, WILC_FAIL);
@@ -890,7 +890,7 @@ static s32 Handle_GetMacAddress(tstrWILC_WFIDrv *drvHandler, tstrHostIfGetMacAdd
strWID.s32ValueSize = ETH_ALEN;
/*Sending Cfg*/
- s32Error = SendConfigPkt(GET_CFG, &strWID, 1, false, (u32)drvHandler);
+ s32Error = SendConfigPkt(GET_CFG, &strWID, 1, false, (size_t)drvHandler);
if (s32Error) {
PRINT_ER("Failed to get mac address\n");
WILC_ERRORREPORT(s32Error, WILC_FAIL);
@@ -1198,7 +1198,7 @@ static s32 Handle_CfgParam(tstrWILC_WFIDrv *drvHandler, tstrHostIFCfgParamAttr *
}
u8WidCnt++;
}
- s32Error = SendConfigPkt(SET_CFG, strWIDList, u8WidCnt, false, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, strWIDList, u8WidCnt, false, (size_t)pstrWFIDrv);
if (s32Error)
PRINT_ER("Error in setting CFG params\n");
@@ -1355,7 +1355,7 @@ static s32 Handle_Scan(tstrWILC_WFIDrv *drvHandler, tstrHostIFscanAttr *pstrHost
else if (pstrWFIDrv->enuHostIFstate == HOST_IF_IDLE)
gbScanWhileConnected = false;
- s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, (size_t)pstrWFIDrv);
if (s32Error) {
PRINT_ER("Failed to send scan paramters config packet\n");
@@ -1432,7 +1432,7 @@ static s32 Handle_ScanDone(tstrWILC_WFIDrv *drvHandler, tenuScanEvent enuEvent)
strWID.s32ValueSize = sizeof(char);
/*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
if (s32Error != WILC_SUCCESS) {
PRINT_ER("Failed to set abort running scan\n");
WILC_ERRORREPORT(s32Error, WILC_FAIL);
@@ -1629,7 +1629,7 @@ static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *ps
gu32WidConnRstHack = 0;
/* ////////////////////// */
- s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, (size_t)pstrWFIDrv);
if (s32Error) {
PRINT_ER("Handle_Connect()] failed to send config packet\n");
WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE);
@@ -1940,7 +1940,7 @@ static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *ps
/*BugID_5137*/
if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) {
memcpy(gu8FlushedJoinReq, pu8CurrByte, gu32FlushedJoinReqSize);
- gu8FlushedJoinReqDrvHandler = (u32)pstrWFIDrv;
+ gu8FlushedJoinReqDrvHandler = (size_t)pstrWFIDrv;
}
PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n");
@@ -1952,7 +1952,7 @@ static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *ps
PRINT_D(GENERIC_DBG, "save bssid = %x:%x:%x:%x:%x:%x\n", (u8ConnectedSSID[0]), (u8ConnectedSSID[1]), (u8ConnectedSSID[2]), (u8ConnectedSSID[3]), (u8ConnectedSSID[4]), (u8ConnectedSSID[5]));
}
- s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, (size_t)pstrWFIDrv);
if (s32Error) {
PRINT_ER("Handle_Connect()] failed to send config packet\n");
WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE);
@@ -2166,7 +2166,7 @@ static s32 Handle_ConnectTimeout(tstrWILC_WFIDrv *drvHandler)
PRINT_D(HOSTINF_DBG, "Sending disconnect request\n");
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (size_t)pstrWFIDrv);
if (s32Error)
PRINT_ER("Failed to send dissconect config packet\n");
@@ -2191,11 +2191,11 @@ static s32 Handle_ConnectTimeout(tstrWILC_WFIDrv *drvHandler)
memset(u8ConnectedSSID, 0, ETH_ALEN);
/*BugID_5213*/
/*Freeing flushed join request params on connect timeout*/
- if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == (u32)drvHandler) {
+ if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == (size_t)drvHandler) {
kfree(gu8FlushedJoinReq);
gu8FlushedJoinReq = NULL;
}
- if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == (u32)drvHandler) {
+ if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == (size_t)drvHandler) {
kfree(gu8FlushedInfoElemAsoc);
gu8FlushedInfoElemAsoc = NULL;
}
@@ -2616,11 +2616,11 @@ static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdGnrlAsy
/*BugID_5213*/
/*Freeing flushed join request params on receiving*/
/*MAC_DISCONNECTED while connected*/
- if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == (u32)drvHandler) {
+ if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == (size_t)drvHandler) {
kfree(gu8FlushedJoinReq);
gu8FlushedJoinReq = NULL;
}
- if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == (u32)drvHandler) {
+ if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == (size_t)drvHandler) {
kfree(gu8FlushedInfoElemAsoc);
gu8FlushedInfoElemAsoc = NULL;
}
@@ -2725,7 +2725,7 @@ static int Handle_Key(tstrWILC_WFIDrv *drvHandler, tstrHostIFkeyAttr *pstrHostIF
strWIDList[3].ps8WidVal = (s8 *)pu8keybuf;
- s32Error = SendConfigPkt(SET_CFG, strWIDList, 4, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, strWIDList, 4, true, (size_t)pstrWFIDrv);
kfree(pu8keybuf);
@@ -2753,7 +2753,7 @@ static int Handle_Key(tstrWILC_WFIDrv *drvHandler, tstrHostIFkeyAttr *pstrHostIF
strWID.ps8WidVal = (s8 *)pu8keybuf;
strWID.s32ValueSize = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen + 2;
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
kfree(pu8keybuf);
} else if (pstrHostIFkeyAttr->u8KeyAction & REMOVEKEY) {
@@ -2765,7 +2765,7 @@ static int Handle_Key(tstrWILC_WFIDrv *drvHandler, tstrHostIFkeyAttr *pstrHostIF
strWID.ps8WidVal = s8idxarray;
strWID.s32ValueSize = 1;
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
} else {
strWID.u16WIDid = (u16)WID_KEY_ID;
strWID.enuWIDtype = WID_CHAR;
@@ -2774,7 +2774,7 @@ static int Handle_Key(tstrWILC_WFIDrv *drvHandler, tstrHostIFkeyAttr *pstrHostIF
PRINT_D(HOSTINF_DBG, "Setting default key index\n");
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
}
up(&(pstrWFIDrv->hSemTestKeyBlock));
break;
@@ -2820,7 +2820,7 @@ static int Handle_Key(tstrWILC_WFIDrv *drvHandler, tstrHostIFkeyAttr *pstrHostIF
strWIDList[1].ps8WidVal = (s8 *)pu8keybuf;
strWIDList[1].s32ValueSize = RX_MIC_KEY_MSG_LEN;
- s32Error = SendConfigPkt(SET_CFG, strWIDList, 2, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, strWIDList, 2, true, (size_t)pstrWFIDrv);
kfree(pu8keybuf);
@@ -2866,7 +2866,7 @@ static int Handle_Key(tstrWILC_WFIDrv *drvHandler, tstrHostIFkeyAttr *pstrHostIF
strWID.ps8WidVal = (s8 *)pu8keybuf;
strWID.s32ValueSize = RX_MIC_KEY_MSG_LEN;
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
kfree(pu8keybuf);
@@ -2923,7 +2923,7 @@ _WPARxGtk_end_case_:
strWIDList[1].ps8WidVal = (s8 *)pu8keybuf;
strWIDList[1].s32ValueSize = PTK_KEY_MSG_LEN + 1;
- s32Error = SendConfigPkt(SET_CFG, strWIDList, 2, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, strWIDList, 2, true, (size_t)pstrWFIDrv);
kfree(pu8keybuf);
/* ////////////////////////// */
@@ -2964,7 +2964,7 @@ _WPARxGtk_end_case_:
strWID.ps8WidVal = (s8 *)pu8keybuf;
strWID.s32ValueSize = PTK_KEY_MSG_LEN;
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
kfree(pu8keybuf);
/* ////////////////////////// */
@@ -3003,7 +3003,7 @@ _WPAPtk_end_case_:
strWID.ps8WidVal = (s8 *)pu8keybuf;
strWID.s32ValueSize = (pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid * PMKSA_KEY_LEN) + 1;
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
kfree(pu8keybuf);
break;
@@ -3052,7 +3052,7 @@ static void Handle_Disconnect(tstrWILC_WFIDrv *drvHandler)
memset(u8ConnectedSSID, 0, ETH_ALEN);
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (size_t)pstrWFIDrv);
if (s32Error) {
PRINT_ER("Failed to send dissconect config packet\n");
@@ -3116,11 +3116,11 @@ static void Handle_Disconnect(tstrWILC_WFIDrv *drvHandler)
/*BugID_5137*/
- if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == (u32)drvHandler) {
+ if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == (size_t)drvHandler) {
kfree(gu8FlushedJoinReq);
gu8FlushedJoinReq = NULL;
}
- if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == (u32)drvHandler) {
+ if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == (size_t)drvHandler) {
kfree(gu8FlushedInfoElemAsoc);
gu8FlushedInfoElemAsoc = NULL;
}
@@ -3165,7 +3165,7 @@ static s32 Switch_Log_Terminal(tstrWILC_WFIDrv *drvHandler)
strWID.ps8WidVal = &dummy;
strWID.s32ValueSize = sizeof(char);
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
if (s32Error) {
@@ -3210,7 +3210,7 @@ static s32 Handle_GetChnl(tstrWILC_WFIDrv *drvHandler)
PRINT_D(HOSTINF_DBG, "Getting channel value\n");
- s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
/*get the value by searching the local copy*/
if (s32Error) {
PRINT_ER("Failed to get channel number\n");
@@ -3254,7 +3254,7 @@ static void Handle_GetRssi(tstrWILC_WFIDrv *drvHandler)
/*Sending Cfg*/
PRINT_D(HOSTINF_DBG, "Getting RSSI value\n");
- s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
if (s32Error) {
PRINT_ER("Failed to get RSSI value\n");
WILC_ERRORREPORT(s32Error, WILC_FAIL);
@@ -3285,7 +3285,7 @@ static void Handle_GetLinkspeed(tstrWILC_WFIDrv *drvHandler)
/*Sending Cfg*/
PRINT_D(HOSTINF_DBG, "Getting LINKSPEED value\n");
- s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
if (s32Error) {
PRINT_ER("Failed to get LINKSPEED value\n");
WILC_ERRORREPORT(s32Error, WILC_FAIL);
@@ -3335,7 +3335,7 @@ s32 Handle_GetStatistics(tstrWILC_WFIDrv *drvHandler, tstrStatistics *pstrStatis
strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u32TxFailureCount));
u32WidsCount++;
- s32Error = SendConfigPkt(GET_CFG, strWIDList, u32WidsCount, false, (u32)drvHandler);
+ s32Error = SendConfigPkt(GET_CFG, strWIDList, u32WidsCount, false, (size_t)drvHandler);
if (s32Error) {
PRINT_ER("Failed to send scan paramters config packet\n");
@@ -3383,7 +3383,7 @@ static s32 Handle_Get_InActiveTime(tstrWILC_WFIDrv *drvHandler, tstrHostIfStaIna
PRINT_D(CFG80211_DBG, "SETING STA inactive time\n");
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
/*get the value by searching the local copy*/
if (s32Error) {
PRINT_ER("Failed to SET incative time\n");
@@ -3397,7 +3397,7 @@ static s32 Handle_Get_InActiveTime(tstrWILC_WFIDrv *drvHandler, tstrHostIfStaIna
strWID.s32ValueSize = sizeof(u32);
- s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
/*get the value by searching the local copy*/
if (s32Error) {
PRINT_ER("Failed to get incative time\n");
@@ -3478,7 +3478,7 @@ static void Handle_AddBeacon(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetBeacon *p
/*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (size_t)pstrWFIDrv);
if (s32Error) {
PRINT_ER("Failed to send add beacon config packet\n");
WILC_ERRORREPORT(s32Error, WILC_FAIL);
@@ -3523,7 +3523,7 @@ static void Handle_DelBeacon(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelBeacon *p
/* TODO: build del beacon message*/
/*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (size_t)pstrWFIDrv);
if (s32Error) {
PRINT_ER("Failed to send delete beacon config packet\n");
@@ -3619,7 +3619,7 @@ static void Handle_AddStation(tstrWILC_WFIDrv *drvHandler, tstrWILC_AddStaParam
pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam);
/*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (size_t)pstrWFIDrv);
if (s32Error != WILC_SUCCESS) {
PRINT_ER("Failed to send add station config packet\n");
@@ -3676,7 +3676,7 @@ static void Handle_DelAllSta(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelAllSta *p
}
/*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
if (s32Error) {
PRINT_ER("Failed to send add station config packet\n");
@@ -3723,7 +3723,7 @@ static void Handle_DelStation(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelSta *pst
memcpy(pu8CurrByte, pstrDelStaParam->au8MacAddr, ETH_ALEN);
/*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (size_t)pstrWFIDrv);
if (s32Error) {
PRINT_ER("Failed to send add station config packet\n");
@@ -3766,7 +3766,7 @@ static void Handle_EditStation(tstrWILC_WFIDrv *drvHandler, tstrWILC_AddStaParam
pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam);
/*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (size_t)pstrWFIDrv);
if (s32Error) {
PRINT_ER("Failed to send edit station config packet\n");
@@ -3842,7 +3842,7 @@ static int Handle_RemainOnChan(tstrWILC_WFIDrv *drvHandler, tstrHostIfRemainOnCh
strWID.ps8WidVal[1] = (s8)pstrHostIfRemainOnChan->u16Channel;
/*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
if (s32Error != WILC_SUCCESS)
PRINT_ER("Failed to set remain on channel\n");
@@ -3897,7 +3897,7 @@ static int Handle_RegisterFrame(tstrWILC_WFIDrv *drvHandler, tstrHostIfRegisterF
/*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
if (s32Error) {
PRINT_ER("Failed to frame register config packet\n");
WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE);
@@ -3948,7 +3948,7 @@ static u32 Handle_ListenStateExpired(tstrWILC_WFIDrv *drvHandler, tstrHostIfRema
strWID.ps8WidVal[1] = FALSE_FRMWR_CHANNEL;
/*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
if (s32Error != WILC_SUCCESS) {
PRINT_ER("Failed to set remain on channel\n");
goto _done_;
@@ -4033,7 +4033,7 @@ static void Handle_PowerManagement(tstrWILC_WFIDrv *drvHandler, tstrHostIfPowerM
PRINT_D(HOSTINF_DBG, "Handling Power Management\n");
/*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
if (s32Error) {
PRINT_ER("Failed to send power management config packet\n");
WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE);
@@ -4084,7 +4084,7 @@ static void Handle_SetMulticastFilter(tstrWILC_WFIDrv *drvHandler, tstrHostIFSet
memcpy(pu8CurrByte, gau8MulticastMacAddrList, ((strHostIfSetMulti->u32count) * ETH_ALEN));
/*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (u32)drvHandler);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, (size_t)drvHandler);
if (s32Error) {
PRINT_ER("Failed to send setup multicast config packet\n");
WILC_ERRORREPORT(s32Error, WILC_FAIL);
@@ -4152,7 +4152,7 @@ static s32 Handle_AddBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionI
/* Group Buffer Timeout */
*ptr++ = 0;
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
if (s32Error)
PRINT_D(HOSTINF_DBG, "Couldn't open BA Session\n");
@@ -4176,7 +4176,7 @@ static s32 Handle_AddBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionI
*ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF);
/*Ack-Policy */
*ptr++ = 3;
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
if (strWID.ps8WidVal != NULL)
kfree(strWID.ps8WidVal);
@@ -4226,7 +4226,7 @@ static s32 Handle_DelBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionI
/* Delba Reason */
*ptr++ = 32; /* Unspecific QOS reason */
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
if (s32Error)
PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n");
@@ -4244,7 +4244,7 @@ static s32 Handle_DelBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionI
/* TID*/
*ptr++ = strHostIfBASessionInfo->u8Ted;
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
if (strWID.ps8WidVal != NULL)
kfree(strWID.ps8WidVal);
@@ -4295,7 +4295,7 @@ static s32 Handle_DelAllRxBASessions(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASe
/* Delba Reason */
*ptr++ = 32; /* Unspecific QOS reason */
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
if (s32Error)
PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n");
@@ -5321,7 +5321,7 @@ s32 host_int_get_site_survey_results(tstrWILC_WFIDrv *hWFIDrv,
astrWIDList[1].ps8WidVal = ppu8RcvdSiteSurveyResults[1];
astrWIDList[1].s32ValueSize = u32MaxSiteSrvyFragLen;
- s32Error = SendConfigPkt(GET_CFG, astrWIDList, 2, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(GET_CFG, astrWIDList, 2, true, (size_t)pstrWFIDrv);
/*get the value by searching the local copy*/
if (s32Error) {
@@ -5687,7 +5687,7 @@ s32 host_int_get_assoc_res_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocRespInfo,
/* Sending Configuration packet */
- s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
if (s32Error) {
PRINT_ER("Failed to send association response config packet\n");
*pu32RcvdAssocRespInfoLen = 0;
@@ -5812,7 +5812,7 @@ s32 host_int_set_wfi_drv_handler(tstrWILC_WFIDrv *u32address)
memset(&strHostIFmsg, 0, sizeof(tstrHostIFmsg));
strHostIFmsg.u16MsgId = HOST_IF_MSG_SET_WFIDRV_HANDLER;
- strHostIFmsg.uniHostIFmsgBody.strHostIfSetDrvHandler.u32Address = u32address;
+ strHostIFmsg.uniHostIFmsgBody.strHostIfSetDrvHandler.u32Address = (size_t)u32address;
/* strHostIFmsg.drvHandler=hWFIDrv; */
s32Error = WILC_MsgQueueSend(&gMsgQHostIF, &strHostIFmsg, sizeof(tstrHostIFmsg), NULL);
@@ -5933,7 +5933,7 @@ s32 host_int_test_set_int_wid(tstrWILC_WFIDrv *hWFIDrv, u32 u32TestMemAddr)
strWID.s32ValueSize = sizeof(u32);
/*Sending Cfg*/
- s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
if (s32Error) {
PRINT_ER("Test Function: Failed to set wid value\n");
WILC_ERRORREPORT(s32Error, WILC_INVALID_STATE);
@@ -6025,7 +6025,7 @@ s32 host_int_test_get_int_wid(tstrWILC_WFIDrv *hWFIDrv, u32 *pu32TestMemAddr)
strWID.ps8WidVal = (s8 *)pu32TestMemAddr;
strWID.s32ValueSize = sizeof(u32);
- s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, (u32)pstrWFIDrv);
+ s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, (size_t)pstrWFIDrv);
/*get the value by searching the local copy*/
if (s32Error) {
PRINT_ER("Test Function: Failed to get wid value\n");
@@ -6750,7 +6750,7 @@ void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length)
{
s32 s32Error = WILC_SUCCESS;
tstrHostIFmsg strHostIFmsg;
- u32 drvHandler;
+ size_t drvHandler;
tstrWILC_WFIDrv *pstrWFIDrv = NULL;
drvHandler = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24));
@@ -6799,7 +6799,7 @@ void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length)
{
s32 s32Error = WILC_SUCCESS;
tstrHostIFmsg strHostIFmsg;
- u32 drvHandler;
+ size_t drvHandler;
tstrWILC_WFIDrv *pstrWFIDrv = NULL;
/*BugID_5348*/
@@ -6861,7 +6861,7 @@ void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length)
{
s32 s32Error = WILC_SUCCESS;
tstrHostIFmsg strHostIFmsg;
- u32 drvHandler;
+ size_t drvHandler;
tstrWILC_WFIDrv *pstrWFIDrv = NULL;
drvHandler = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24));
diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h
index e66dee9..cb46a34 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -272,7 +272,7 @@ typedef struct {
} tstrWILC_UsrConnReq;
typedef struct {
- u32 u32Address;
+ size_t u32Address;
} tstrHostIfSetDrvHandler;
typedef struct {
--
2.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 1/1] staging: wilc1000: replace addresses variables type from u32 to size_t for x64 systems
[not found] ` <14628.1439831571@turing-police.cc.vt.edu>
@ 2015-08-17 17:33 ` Raphaël Beamonte
0 siblings, 0 replies; 5+ messages in thread
From: Raphaël Beamonte @ 2015-08-17 17:33 UTC (permalink / raw)
To: kernelnewbies
2015-08-17 13:12 GMT-04:00 <Valdis.Kletnieks@vt.edu>:
> If you're going to do this, do it *right* and chase down where all these
> variables are defined and nail them down to a size_t *there* so you can get rid
> of most of these casts - plus potentially find *other* places they're playing
> fast and loose with the types.
You're right. I tried first to use the struct that is used to declare
pstrWFIDrv, but
as it needed a lot of code refactoring I switched to find an easier
path, but that's
not as elegant and clean.
> Umm.. this isn't for a brain-dead card that has to have its addresses
> down in the the first 4G of memory, is it? Or was the driver author
> stuck on a 32-bit kernel?
Actually, that's what I wondered also! With further researchs, I just ended
up finding those patches in the linux-wireless mailing list:
http://www.spinics.net/lists/linux-wireless/msg138655.html
http://www.spinics.net/lists/linux-wireless/msg138656.html
These patches are not integrated with Greg's staging tree yet it seems. That's
probably why I missed them at first... They however seem more clean than mine.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 0/1] staging: wilc1000: need feedback about a patch
2015-08-17 16:55 [PATCH 0/1] staging: wilc1000: need feedback about a patch Raphaël Beamonte
2015-08-17 16:55 ` [PATCH 1/1] staging: wilc1000: replace addresses variables type from u32 to size_t for x64 systems Raphaël Beamonte
@ 2015-08-17 19:55 ` Greg Kroah-Hartman
2015-08-17 23:20 ` Raphaël Beamonte
1 sibling, 1 reply; 5+ messages in thread
From: Greg Kroah-Hartman @ 2015-08-17 19:55 UTC (permalink / raw)
To: kernelnewbies
On Mon, Aug 17, 2015 at 12:55:06PM -0400, Rapha?l Beamonte wrote:
> Hello there,
>
> I just started patching some drivers to familiarize myself better
> with the kernel and perhaps contribute more to it if I find things
> that I can actually handle! (hoping I'll be able to handle more and
> more throughout time).
>
> Doing so, I found out that in the wilc1000 (staging) driver, I got
> compiler warnings for casts from u32 variables to pointers and
> pointers to u32 variables.
This driver is known broken in this way, please see the many discussions
about this on the driverdevel mailing list as to what the original
developers of the code are trying to do to fix this, and attempts for
others who are also trying to clean it up in this way.
I'm also not going to take this type of changes from anyone that does
not have the hardware to properly test it, do you have the hardware that
this driver controls?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 0/1] staging: wilc1000: need feedback about a patch
2015-08-17 19:55 ` [PATCH 0/1] staging: wilc1000: need feedback about a patch Greg Kroah-Hartman
@ 2015-08-17 23:20 ` Raphaël Beamonte
0 siblings, 0 replies; 5+ messages in thread
From: Raphaël Beamonte @ 2015-08-17 23:20 UTC (permalink / raw)
To: kernelnewbies
2015-08-17 15:55 GMT-04:00 Greg Kroah-Hartman <gregkh@linuxfoundation.org>:
> This driver is known broken in this way, please see the many discussions
> about this on the driverdevel mailing list as to what the original
> developers of the code are trying to do to fix this, and attempts for
> others who are also trying to clean it up in this way.
Good tip! I looked up different mailing lists but didn't come across
the driver development one, even though I've been sending patches to
it in cc... Sorry for that.
> I'm also not going to take this type of changes from anyone that does
> not have the hardware to properly test it, do you have the hardware that
> this driver controls?
No, you're right. I'm trying to contribute with what I find I can do,
but I'm still just cutting my teeth at that for the time being. I'm
trying to acquire a better knowledge of kernel development to try to
contribute at a deeper level in the end. I thought I could work on
that, but that'll indeed be difficult to test it without the hardware.
Thanks for the time you're taking to review my patches and give advices Greg!
Rapha?l
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-08-17 23:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-17 16:55 [PATCH 0/1] staging: wilc1000: need feedback about a patch Raphaël Beamonte
2015-08-17 16:55 ` [PATCH 1/1] staging: wilc1000: replace addresses variables type from u32 to size_t for x64 systems Raphaël Beamonte
[not found] ` <14628.1439831571@turing-police.cc.vt.edu>
2015-08-17 17:33 ` Raphaël Beamonte
2015-08-17 19:55 ` [PATCH 0/1] staging: wilc1000: need feedback about a patch Greg Kroah-Hartman
2015-08-17 23:20 ` Raphaël Beamonte
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).