staging: rtl8712: Fixed sparse warnings
cover staging: rtl8712: Fixed sparse warnings
In this set of patches I fixed most sparse endian warnings for the rtl8712 driver.
PATCH 2/13 staging: rtl8712: changed variables to __le32
Fixed sparse warning "cast to restricted __le32". Changed struct tx_desc members to __le32 and pcmdbuf to __le32.
--- drivers/staging/rtl8712/rtl8712_cmd.c | 5 +++-- drivers/staging/rtl8712/rtl8712_xmit.h | 16 ++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-)
drivers/staging/rtl8712/rtl8712_cmd.c +3 -2
@@ -314,7 +314,8 @@ void r8712_fw_cmd_data(struct _adapter *pAdapter, u32 *value, u8 flag)int r8712_cmd_thread (void *context) {struct cmd_obj *pcmd; -unsigned int cmdsz, wr_sz, *pcmdbuf; +unsigned int cmdsz, wr_sz; +__le32 *pcmdbuf;struct tx_desc *pdesc;void (*pcmd_callback)(struct _adapter *dev,struct cmd_obj *pcmd);struct _adapter *padapter = context;
@@ -334,7 +335,7 @@ int r8712_cmd_thread(void *context)r8712_unregister_cmd_alive (padapter);continue ; } - pcmdbuf = (unsigned int *)pcmdpriv->cmd_buf; + pcmdbuf = (__le32 *)pcmdpriv->cmd_buf; pdesc = (struct tx_desc *)pcmdbuf;memset (pdesc,0 ,TXDESC_SIZE ); pcmd =cmd_hdl_filter (padapter, pcmd);
drivers/staging/rtl8712/rtl8712_xmit.h +8 -8
@@ -91,14 +91,14 @@struct tx_desc {/*DWORD 0*/ -unsigned int txdw0; -unsigned int txdw1; -unsigned int txdw2; -unsigned int txdw3; -unsigned int txdw4; -unsigned int txdw5; -unsigned int txdw6; -unsigned int txdw7; +__le32 txdw0; +__le32 txdw1; +__le32 txdw2; +__le32 txdw3; +__le32 txdw4; +__le32 txdw5; +__le32 txdw6; +__le32 txdw7; };
Signature · 1 line
2.7.4
PATCH 3/13 staging: rtl8712: changed function argument to __le32
In reply to Jannik BecherFixed a sparse warning "cast to restricted __le32". Function argument is of type __le32.
--- drivers/staging/rtl8712/rtl8712_cmd.c | 2 +- drivers/staging/rtl8712/rtl8712_event.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8712/rtl8712_cmd.c +1 -1
@@ -425,7 +425,7 @@ int r8712_cmd_thread(void *context)thread_exit (); } -void r8712_event_handle (struct _adapter *padapter,uint *peventbuf) +void r8712_event_handle (struct _adapter *padapter,__le32 *peventbuf) {u8 evt_code, evt_seq;u16 evt_sz;
drivers/staging/rtl8712/rtl8712_event.h +1 -1
@@ -26,7 +26,7 @@#ifndef _RTL8712_EVENT_H_#define _RTL8712_EVENT_H_ -void r8712_event_handle (struct _adapter *padapter,uint *peventbuf); +void r8712_event_handle (struct _adapter *padapter,__le32 *peventbuf);void r8712_got_addbareq_event_callback (struct _adapter *adapter,u8 *pbuf); enum rtl8712_c2h_event {
Signature · 1 line
2.7.4
PATCH 8/13 staging: rtl8712: changed uint to __le32
In reply to Jannik BecherFixed a sparse warning.
Just changed uint to __le32.
--- drivers/staging/rtl8712/usb_ops_linux.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/rtl8712/usb_ops_linux.c +3 -2
@@ -192,7 +192,8 @@ void r8712_usb_write_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem)static void r8712_usb_read_port_complete (struct urb *purb) { -uint isevt, *pbuf; +uint isevt; +__le32 *pbuf;struct recv_buf *precvbuf = (struct recv_buf *)purb->context;struct _adapter *padapter = (struct _adapter *)precvbuf->adapter;struct recv_priv *precvpriv = &padapter->recvpriv;
@@ -208,7 +209,7 @@ static void r8712_usb_read_port_complete(struct urb *purb)_pkt *pskb = precvbuf->pskb; precvbuf->transfer_len = purb->actual_length; - pbuf = (uint *)precvbuf->pbuf; + pbuf = (__le32 *)precvbuf->pbuf; isevt =le32_to_cpu (*(pbuf +1 )) &0x1ff ;if ((isevt &0x1ff ) ==0x1ff ) {r8712_rxcmd_event_hdl (padapter, pbuf);
Signature · 1 line
2.7.4
PATCH 7/13 staging: rtl8712: changed u32 to __le32
In reply to Jannik BecherFixed sparse warning.
Just changed u32 to __le32.
--- drivers/staging/rtl8712/usb_ops.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
drivers/staging/rtl8712/usb_ops.c +8 -10
@@ -41,7 +41,7 @@ static u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr)u16 wvalue;u16 index;u16 len; -u32 data; +__le32 data;struct intf_priv *pintfpriv = pintfhdl->pintfpriv; request =0x05 ;
@@ -61,7 +61,7 @@ static u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr)u16 wvalue;u16 index;u16 len; -u32 data; +__le32 data;struct intf_priv *pintfpriv = pintfhdl->pintfpriv; request =0x05 ;
@@ -81,7 +81,7 @@ static u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr)u16 wvalue;u16 index;u16 len; -u32 data; +__le32 data;struct intf_priv *pintfpriv = pintfhdl->pintfpriv; request =0x05 ;
@@ -101,7 +101,7 @@ static void usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val)u16 wvalue;u16 index;u16 len; -u32 data; +__le32 data;struct intf_priv *pintfpriv = pintfhdl->pintfpriv; request =0x05 ;
@@ -109,8 +109,7 @@ static void usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val) index =0 ; wvalue = (u16)(addr &0x0000ffff ); len =1 ; - data = val; - data =cpu_to_le32 (data &0x000000ff ); + data =cpu_to_le32 ((u32 )val &0x000000ff );r8712_usbctrl_vendorreq (pintfpriv, request, wvalue, index, &data, len, requesttype); }
@@ -122,7 +121,7 @@ static void usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)u16 wvalue;u16 index;u16 len; -u32 data; +__le32 data;struct intf_priv *pintfpriv = pintfhdl->pintfpriv; request =0x05 ;
@@ -130,8 +129,7 @@ static void usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val) index =0 ; wvalue = (u16)(addr &0x0000ffff ); len =2 ; - data = val; - data =cpu_to_le32 (data &0x0000ffff ); + data =cpu_to_le32 ((u32 )val &0x0000ffff );r8712_usbctrl_vendorreq (pintfpriv, request, wvalue, index, &data, len, requesttype); }
@@ -143,7 +141,7 @@ static void usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)u16 wvalue;u16 index;u16 len; -u32 data; +__le32 data;struct intf_priv *pintfpriv = pintfhdl->pintfpriv; request =0x05 ;
Signature · 1 line
2.7.4
PATCH 9/13 staging: rtl8712: fixed little endian problem
In reply to Jannik BecherFixed a sparse warning.
Using function le16_to_cpus() to avoid double assignment.
--- drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +1 -1
@@ -199,7 +199,7 @@ static noinline_for_stack char *translate_scan(struct _adapter *padapter, iwe.cmd =SIOCGIWMODE ;memcpy ((u8 *)&cap,r8712_get_capability_from_ie (pnetwork->network.IEs),2 ); - cap =le16_to_cpu (cap); +le16_to_cpus (&cap);if (cap & (WLAN_CAPABILITY_IBSS |WLAN_CAPABILITY_BSS )) {if (cap &WLAN_CAPABILITY_BSS ) iwe.u.mode = (u32 )IW_MODE_MASTER ;
Signature · 1 line
2.7.4
PATCH 13/13 staging: rtl8712: used a better macro
In reply to Jannik BecherFixed a sparse warning.
Using be16_to_cpus() to avoid double assignment.
--- drivers/staging/rtl8712/rtl871x_recv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8712/rtl871x_recv.c +1 -1
@@ -258,7 +258,7 @@ union recv_frame *r8712_portctrl(struct _adapter *adapter,/* get ether_type */ ptr = ptr + pfhdr->attrib.hdrlen +LLC_HEADER_SIZE ;memcpy (ðer_type, ptr,2 ); - ether_type =ntohs ((unsigned short )ether_type); +be16_to_cpus (ðer_type);if ((psta !=NULL ) && (psta->ieee8021x_blocked)) {/* blocked
Signature · 1 line
2.7.4
PATCH 12/13 staging: rtl8712: changed u16 to __be16
In reply to Jannik BecherFixed sparse warning.
Just changed u16 to __be16 and typecasts.
--- drivers/staging/rtl8712/rtl8712_recv.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/rtl8712/rtl8712_recv.c +5 -5
@@ -408,7 +408,7 @@ static int amsdu_to_msdu(struct _adapter *padapter, union recv_frame *prframe)memcpy (skb_push (sub_skb,ETH_ALEN ), pattrib->dst,ETH_ALEN ); }else { -u16 len; +__be16 len;/* Leave Ethernet header part of hdr and full payload */ len =htons (sub_skb->len);memcpy (skb_push (sub_skb,2 ), &len,2 );
@@ -439,21 +439,21 @@ static int amsdu_to_msdu(struct _adapter *padapter, union recv_frame *prframe)void r8712_rxcmd_event_hdl (struct _adapter *padapter,void *prxcmdbuf) { -uint voffset; +__le32 voffset;u8 *poffset;u16 cmd_len, drvinfo_sz;struct recv_stat *prxstat; poffset = (u8 *)prxcmdbuf; - voffset = *(uint *)poffset; + voffset = *(__le32 *)poffset; prxstat = (struct recv_stat *)prxcmdbuf; drvinfo_sz = (le32_to_cpu (prxstat->rxdw0) &0x000f0000 ) >>16 ; drvinfo_sz <<=3 ; poffset +=RXDESC_SIZE + drvinfo_sz;do { - voffset = *(uint *)poffset; + voffset = *(__le32 *)poffset; cmd_len = (u16)(le32_to_cpu (voffset) &0xffff ); -r8712_event_handle (padapter, (uint *)poffset); +r8712_event_handle (padapter, (__le32 *)poffset); poffset += (cmd_len +8 );/*8 bytes alignment*/ }while (le32_to_cpu (voffset) &BIT (31 ));
Signature · 1 line
2.7.4
PATCH 11/13 staging: rtl8712: changed cast to __le16
In reply to Jannik BecherFixed sparse warning.
Changed u16 to __le16
--- drivers/staging/rtl8712/ieee80211.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/staging/rtl8712/ieee80211.c +7 -7
@@ -174,16 +174,16 @@ int r8712_generate_ie(struct registry_priv *pregistrypriv) sz +=8 ; ie += sz;/*beacon interval : 2bytes*/ - *(u16 *)ie =cpu_to_le16 ((u16 )pdev_network->Configuration.BeaconPeriod); + *(__le16 *)ie =cpu_to_le16 ((u16 )pdev_network->Configuration.BeaconPeriod); sz +=2 ; ie +=2 ;/*capability info*/ *(u16 *)ie =0 ; - *(u16 *)ie |=cpu_to_le16 (cap_IBSS); + *(__le16 *)ie |=cpu_to_le16 (cap_IBSS);if (pregistrypriv->preamble ==PREAMBLE_SHORT ) - *(u16 *)ie |=cpu_to_le16 (cap_ShortPremble); + *(__le16 *)ie |=cpu_to_le16 (cap_ShortPremble);if (pdev_network->Privacy) - *(u16 *)ie |=cpu_to_le16 (cap_Privacy); + *(__le16 *)ie |=cpu_to_le16 (cap_Privacy); sz +=2 ; ie +=2 ;/*SSID*/
@@ -224,7 +224,7 @@ unsigned char *r8712_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit) goto check_next_ie;/*check version...*/ memcpy ((u8 *)&val16, (pbuf +6 ),sizeof (val16)); - val16 =le16_to_cpu (val16); +le16_to_cpus (&val16);if (val16 !=0x0001 ) goto check_next_ie; *wpa_ie_len = *(pbuf +1 );
@@ -304,7 +304,7 @@ int r8712_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher, }/*pairwise_cipher*/ if (left >=2 ) { - count =le16_to_cpu (*(u16 *)pos); + count =le16_to_cpu (*(__le16 *)pos); pos +=2 ; left -=2 ;if (count ==0 || left < count *WPA_SELECTOR_LEN )
@@ -347,7 +347,7 @@ int r8712_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher, }/*pairwise_cipher*/ if (left >=2 ) { - count =le16_to_cpu (*(u16 *)pos); + count =le16_to_cpu (*(__le16 *)pos); pos +=2 ; left -=2 ;if (count ==0 || left < count *RSN_SELECTOR_LEN )
Signature · 1 line
2.7.4
PATCH 10/13 staging: rtl8712: changed u32 to __le32
In reply to Jannik BecherFixed sparse warnings.
Deleted cpu_to_le32() for enum. I'm not sure why it was there.
--- drivers/staging/rtl8712/rtl871x_event.h | 2 +- drivers/staging/rtl8712/rtl871x_mlme.c | 15 +++++++-------- drivers/staging/rtl8712/wlan_bssdef.h | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-)
drivers/staging/rtl8712/rtl871x_event.h +1 -1
@@ -66,7 +66,7 @@ struct joinbss_event {struct stassoc_event {unsigned char macaddr[6 ];unsigned char rsvd[2 ]; -int cam_id; +__le32 cam_id; };struct stadel_event {
drivers/staging/rtl8712/rtl871x_mlme.c +7 -8
@@ -257,10 +257,10 @@ int r8712_is_same_ibss(struct _adapter *adapter, struct wlan_network *pnetwork)struct security_priv *psecuritypriv = &adapter->securitypriv;if ((psecuritypriv->PrivacyAlgrthm != _NO_PRIVACY_) && - (pnetwork->network.Privacy ==0 )) + (pnetwork->network.Privacy ==cpu_to_le32 (0 ))) ret = false;else if ((psecuritypriv->PrivacyAlgrthm == _NO_PRIVACY_) && - (pnetwork->network.Privacy ==1 )) + (pnetwork->network.Privacy ==cpu_to_le32 (1 ))) ret = false;else ret = true;
@@ -933,7 +933,7 @@ void r8712_stassoc_event_callback(struct _adapter *adapter, u8 *pbuf)return ;/* to do : init sta_info variable */ psta->qos_option =0 ; - psta->mac_id =le32_to_cpu ((uint )pstassoc->cam_id); + psta->mac_id =le32_to_cpu (pstassoc->cam_id);/* psta->aid = (uint)pstassoc->cam_id; */ if (adapter->securitypriv.AuthAlgrthm ==2 )
@@ -1637,14 +1637,14 @@ void r8712_update_registrypriv_dev_network(struct _adapter *adapter) pdev_network->Rssi =0 ;switch (pregistrypriv->wireless_mode) {case WIRELESS_11B : - pdev_network->NetworkTypeInUse =cpu_to_le32 (Ndis802_11DS); + pdev_network->NetworkTypeInUse = Ndis802_11DS;break ;case WIRELESS_11G :case WIRELESS_11BG : - pdev_network->NetworkTypeInUse =cpu_to_le32 (Ndis802_11OFDM24); + pdev_network->NetworkTypeInUse = Ndis802_11OFDM24;break ;case WIRELESS_11A : - pdev_network->NetworkTypeInUse =cpu_to_le32 (Ndis802_11OFDM5); + pdev_network->NetworkTypeInUse = Ndis802_11OFDM5;break ;default :/* TODO */
@@ -1654,8 +1654,7 @@ void r8712_update_registrypriv_dev_network(struct _adapter *adapter) pregistrypriv->channel);if (cur_network->network.InfrastructureMode == Ndis802_11IBSS) pdev_network->Configuration.ATIMWindow =cpu_to_le32 (3 ); - pdev_network->InfrastructureMode =cpu_to_le32 ( - cur_network->network.InfrastructureMode); + pdev_network->InfrastructureMode = cur_network->network.InfrastructureMode;/* 1. Supported rates * 2. IE */
drivers/staging/rtl8712/wlan_bssdef.h +1 -1
@@ -83,7 +83,7 @@ struct wlan_bssid_ex {unsigned char MacAddress[6 ];u8 Reserved[2 ];struct ndis_802_11_ssid Ssid; -u32 Privacy; +__le32 Privacy;s32 Rssi;enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;struct NDIS_802_11_CONFIGURATION Configuration;
Signature · 1 line
2.7.4
PATCH 6/13 staging: rtl8712: changed typecast to __le
In reply to Jannik BecherFixed sparse warning.
Changed uint to __le16 and __le32.
--- drivers/staging/rtl8712/hal_init.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/rtl8712/hal_init.c +6 -6
@@ -117,16 +117,16 @@ static void fill_fwpriv(struct _adapter *padapter, struct fw_priv *pfwpriv)static void update_fwhdr (struct fw_hdr *pfwhdr,const u8 *pmappedfw) { - pfwhdr->signature =le16_to_cpu (*(u16 *)pmappedfw); - pfwhdr->version =le16_to_cpu (*(u16 *)(pmappedfw +2 )); + pfwhdr->signature =le16_to_cpu (*(__le16 *)pmappedfw); + pfwhdr->version =le16_to_cpu (*(__le16 *)(pmappedfw +2 ));/* define the size of boot loader */ - pfwhdr->dmem_size =le32_to_cpu (*(uint *)(pmappedfw +4 )); + pfwhdr->dmem_size =le32_to_cpu (*(__le32 *)(pmappedfw +4 ));/* define the size of FW in IMEM */ - pfwhdr->img_IMEM_size =le32_to_cpu (*(uint *)(pmappedfw +8 )); + pfwhdr->img_IMEM_size =le32_to_cpu (*(__le32 *)(pmappedfw +8 ));/* define the size of FW in SRAM */ - pfwhdr->img_SRAM_size =le32_to_cpu (*(uint *)(pmappedfw +12 )); + pfwhdr->img_SRAM_size =le32_to_cpu (*(__le32 *)(pmappedfw +12 ));/* define the size of DMEM variable */ - pfwhdr->fw_priv_sz =le32_to_cpu (*(uint *)(pmappedfw +16 )); + pfwhdr->fw_priv_sz =le32_to_cpu (*(__le32 *)(pmappedfw +16 )); }static u8 chk_fwhdr (struct fw_hdr *pfwhdr,u32 ulfilelength)
Signature · 1 line
2.7.4
PATCH 1/13 staging: rtl8712: changed struct members to __le32
In reply to Jannik BecherFixed sparse warning "cast to restricted __le32". struct sitesurvey_parm uses little endian members.
--- drivers/staging/rtl8712/rtl871x_cmd.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8712/rtl871x_cmd.h +3 -3
@@ -156,9 +156,9 @@ struct setopmode_parm {* Command-Event Mode */ struct sitesurvey_parm { -sint passive_mode;/*active: 1, passive: 0 */ -sint bsslimit;/* 1 ~ 48 */ -sint ss_ssidlen; +__le32 passive_mode;/*active: 1, passive: 0 */ +__le32 bsslimit;/* 1 ~ 48 */ +__le32 ss_ssidlen;u8 ss_ssid[IW_ESSID_MAX_SIZE +1 ]; };
Signature · 1 line
2.7.4
PATCH 5/13 staging: rtl8712: changed GetFrameSubType macro
In reply to Jannik BecherFixed a sparse warning.
GetFrameSubType and GetFrameType should cast to __le16. Furthermore GetFramSubType should use le16_to_cpu instead of cpu_to_le16.
--- drivers/staging/rtl8712/rtl871x_security.c | 4 ++-- drivers/staging/rtl8712/wifi.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/rtl8712/rtl871x_security.c +2 -2
@@ -1047,8 +1047,8 @@ static sint aes_cipher(u8 *key, uint hdrlen,u8 aes_out[16 ];u8 padded_buffer[16 ];u8 mic[8 ]; -uint frtype =GetFrameType (pframe); -uint frsubtype =GetFrameSubType (pframe); +u16 frtype =GetFrameType (pframe); +u16 frsubtype =GetFrameSubType (pframe); frsubtype >>=4 ;memset ((void *)mic_iv,0 ,16 );
drivers/staging/rtl8712/wifi.h +2 -2
@@ -229,7 +229,7 @@ enum WIFI_REG_DOMAIN {#define GetOrder (pbuf) (((*(unsigned short *)(pbuf)) & \ le16_to_cpu(_ORDER_)) != 0) -#define GetFrameType (pbuf) (le16_to_cpu(*(unsigned short *)(pbuf)) & \ +#define GetFrameType (pbuf) (le16_to_cpu(*(__le16 *)(pbuf)) & \ (BIT(3) | BIT(2)))#define SetFrameType (pbuf, type) \
@@ -239,7 +239,7 @@ enum WIFI_REG_DOMAIN { *(unsigned short *)(pbuf) |=cpu_to_le16 (type); \ }while (0 ) -#define GetFrameSubType(pbuf) (cpu_to_le16(*(unsigned short *)(pbuf)) & \ +#define GetFrameSubType(pbuf) (le16_to_cpu(*(__le16 *)(pbuf)) & \ (BIT (7 ) |BIT (6 ) |BIT (5 ) |BIT (4 ) |BIT (3 ) | \BIT (2 )))
Signature · 1 line
2.7.4
PATCH 4/13 staging: rtl8712: casted variables to __le32
In reply to Jannik BecherFixed a sparse warning.
Casting __le32 variables to the right type.
--- drivers/staging/rtl8712/rtl871x_security.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/rtl8712/rtl871x_security.c +6 -6
@@ -192,7 +192,7 @@ void r8712_wep_encrypt(struct _adapter *padapter, u8 *pxmitframe) length = pattrib->last_txcmdsz - pattrib-> hdrlen - pattrib->iv_len - pattrib->icv_len; - *((u32 *)crc) =cpu_to_le32 (getcrc32 ( + *((__le32 *)crc) =cpu_to_le32 (getcrc32 ( payload, length));arcfour_init (&mycontext, wepkey,3 + keylength); arcfour_encrypt(&mycontext, payload, payload,
@@ -203,7 +203,7 @@ void r8712_wep_encrypt(struct _adapter *padapter, u8 *pxmitframe) length = pxmitpriv->frag_len - pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len; - *((u32 *)crc) =cpu_to_le32 (getcrc32 ( + *((__le32 *)crc) =cpu_to_le32 (getcrc32 ( payload, length));arcfour_init (&mycontext, wepkey,3 + keylength); arcfour_encrypt(&mycontext, payload, payload,
@@ -248,7 +248,7 @@ void r8712_wep_decrypt(struct _adapter *padapter, u8 *precvframe)arcfour_init (&mycontext, wepkey,3 + keylength);arcfour_encrypt (&mycontext, payload, payload, length);/* calculate icv and compare the icv */ - *((u32 *)crc) =cpu_to_le32 (getcrc32 (payload, length -4 )); + *((__le32 *)crc) =cpu_to_le32 (getcrc32 (payload, length -4 )); } }
@@ -616,7 +616,7 @@ u32 r8712_tkip_encrypt(struct _adapter *padapter, u8 *pxmitframe) pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len; - *((u32 *)crc) =cpu_to_le32 ( + *((__le32 *)crc) =cpu_to_le32 (getcrc32 (payload, length));arcfour_init (&mycontext, rc4key,16 ); arcfour_encrypt(&mycontext, payload,
@@ -628,7 +628,7 @@ u32 r8712_tkip_encrypt(struct _adapter *padapter, u8 *pxmitframe) pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len; - *((u32 *)crc) =cpu_to_le32 (getcrc32 ( + *((__le32 *)crc) =cpu_to_le32 (getcrc32 ( payload, length));arcfour_init (&mycontext, rc4key,16 ); arcfour_encrypt(&mycontext, payload,
@@ -696,7 +696,7 @@ u32 r8712_tkip_decrypt(struct _adapter *padapter, u8 *precvframe)/* 4 decrypt payload include icv */ arcfour_init (&mycontext, rc4key,16 );arcfour_encrypt (&mycontext, payload, payload, length); - *((u32 *)crc) =cpu_to_le32 (getcrc32 (payload, + *((__le32 *)crc) =cpu_to_le32 (getcrc32 (payload, length -4 )); if (crc[3] != payload[length - 1] || crc[2] != payload[length - 2] ||
Signature · 1 line
2.7.4