Staging: Use put_unaligned_le16
v3 cover Staging: Use put_unaligned_le16
This patch series introduces the use of function put_unaligned_le16 as Using byte ordering functions and then memcpy() is risky and prone to hide errors which are hard to track down.
This change is done using Coccinelle.
Changes in v3:
-Two separate patches are merged in a patch series
Vaishali Thakkar (2):
Staging: rtl8188eu: Use put_unaligned_le16
Staging: rtl8723au: Use put_unaligned_le16
drivers/staging/rtl8188eu/core/rtw_ap.c | 8 +++----- drivers/staging/rtl8723au/core/rtw_ap.c | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-)
Signature · 1 line
1.9.1
PATCH v3 1/2 Staging: rtl8188eu: Use put_unaligned_le16
Using byte ordering functions and then memcpy() is risky and prone to hide errors which are hard to track down. So, this patch introduces the use of function put_unaligned_le16 which makes the code clear. Here, use of variable tim_bitmap_le and variable itself is removed. Also, to be compatible with the changes header file is added too.
Coccinelle is used to do this change and semantic patch used for this is as follows:
@a@
typedef __le16;__le16 e16;
identifier tmp;
expression ptr;
expression y,e;
type T;
@@
- tmp = cpu_to_le16(y);
<+... when != tmp
(
- memcpy(ptr, (T)&tmp, \(2\|sizeof(__le16)\|sizeof(e16)\));
+ put_unaligned_le16(y,ptr);
|
- memcpy(ptr, (T)&tmp, ...);
+ put_unaligned_le16(y,ptr);
)
...+>
? tmp = e
@@ type T; identifier a.tmp; @@
- T tmp;
...when != tmp
---
Changes since v2:
-Edit commit log
-Merge this patch in a patch-series
Changes since v1:
-Remove use of variable tim_bitmap_le -Remove variable tim_bitmap_le
-Add header file to be compatible with the changes -Edit commit log
drivers/staging/rtl8188eu/core/rtw_ap.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/staging/rtl8188eu/core/rtw_ap.c +3 -5
@@ -23,6 +23,7 @@#include <drv_types.h> #include <wifi.h> #include <ieee80211.h> +#include <asm/unaligned.h> #ifdef CONFIG_88EU_AP_MODE
@@ -78,11 +79,8 @@ static void update_BCNTIM(struct adapter *padapter)if (true) {u8 *p, *dst_ie, *premainder_ie =NULL ;u8 *pbackup_remainder_ie =NULL ; -__le16 tim_bitmap_le;uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen; - tim_bitmap_le =cpu_to_le16 (pstapriv->tim_bitmap); - p =rtw_get_ie (pie + _FIXED_IE_LENGTH_, _TIM_IE_, &tim_ielen, pnetwork_mlmeext->IELength - _FIXED_IE_LENGTH_);if (p !=NULL && tim_ielen >0 ) { tim_ielen +=2 ;
@@ -137,9 +135,9 @@ static void update_BCNTIM(struct adapter *padapter) *dst_ie++ =0 ;if (tim_ielen ==4 ) { - *dst_ie++ = *(u8 *)&tim_bitmap_le; + *dst_ie++ = pstapriv->tim_bitmap &0xff ; }else if (tim_ielen ==5 ) { -memcpy (dst_ie, &tim_bitmap_le,2 ); +put_unaligned_le16 (pstapriv->tim_bitmap, dst_ie); dst_ie +=2 ; }
Signature · 1 line
1.9.1
PATCH v3 2/2 Staging: rtl8723au: Use put_unaligned_le16
In reply to Vaishali ThakkarUsing byte ordering functions and then memcpy() is risky and prone to hide errors which are hard to track down. So, this patch introduces the use of function put_unaligned_le16 which makes the code clear. Here, use of variable tim_bitmap_le and variable itself is removed. Also, to be compatible with the changes header file is added too.
Coccinelle is used to do this change and semantic patch used for this is as follows:
@a@
typedef __le16;__le16 e16;
identifier tmp;
expression ptr;
expression y,e;
type T;
@@
- tmp = cpu_to_le16(y);
<+... when != tmp
(
- memcpy(ptr, (T)&tmp, \(2\|sizeof(__le16)\|sizeof(e16)\));
+ put_unaligned_le16(y,ptr);
|
- memcpy(ptr, (T)&tmp, ...);
+ put_unaligned_le16(y,ptr);
)
...+>
? tmp = e
@@ type T; identifier a.tmp; @@
- T tmp;
...when != tmp
---
Changes since v1:
-Edit commit log
-Merge this patch in a patch series
drivers/staging/rtl8723au/core/rtw_ap.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/staging/rtl8723au/core/rtw_ap.c +3 -5
@@ -20,6 +20,7 @@#include <wifi.h> #include <rtl8723a_cmd.h> #include <rtl8723a_hal.h> +#include <asm/unaligned.h> extern unsigned char WMM_OUI23A [];extern unsigned char WPS_OUI23A [];
@@ -72,11 +73,8 @@ static void update_BCNTIM(struct rtw_adapter *padapter)struct wlan_bssid_ex *pnetwork_mlmeext = &pmlmeinfo->network;unsigned char *pie = pnetwork_mlmeext->IEs;u8 *p, *dst_ie, *premainder_ie =NULL , *pbackup_remainder_ie =NULL ; -__le16 tim_bitmap_le;uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen; - tim_bitmap_le =cpu_to_le16 (pstapriv->tim_bitmap); - p =rtw_get_ie23a (pie,WLAN_EID_TIM , &tim_ielen, pnetwork_mlmeext->IELength);if (p !=NULL && tim_ielen >0 ) {
@@ -143,9 +141,9 @@ static void update_BCNTIM(struct rtw_adapter *padapter) *dst_ie++ =0 ;if (tim_ielen ==4 ) { - *dst_ie++ = *(u8 *)&tim_bitmap_le; + *dst_ie++ = pstapriv->tim_bitmap &0xff ; }else if (tim_ielen ==5 ) { -memcpy (dst_ie, &tim_bitmap_le,2 ); +put_unaligned_le16 (pstapriv->tim_bitmap, dst_ie); dst_ie +=2 ; }
Signature · 1 line
1.9.1
Re: [Outreachy kernel] [PATCH v3 2/2] Staging: rtl8723au: Use put_unaligned_le16
Quoted 34 lines · Vaishali Thakkar
Using byte ordering functions and then
memcpy()is risky and prone to hide errors which are hard to track down. So, this patch introduces the use of functionput_unaligned_le16which makes the code clear. Here, use of variabletim_bitmap_leand variable itself is removed. Also, to be compatible with the changes header file is added too.Coccinelle is used to do this change and semantic patch used for this is as follows:
@a@
typedef__le16;__le16e16;
identifier tmp;
expression ptr;
expression y,e;
type T;
@@- tmp =
cpu_to_le16(y);<+... when != tmp
(
-memcpy(ptr, (T)&tmp, \(2\|sizeof(__le16)\|sizeof(e16)\));
+put_unaligned_le16(y,ptr);
|
-memcpy(ptr, (T)&tmp, ...);
+put_unaligned_le16(y,ptr);
)
...+>
? tmp = e@@ type T; identifier a.tmp; @@
Quoted 8 lines
- T tmp;
...when != tmpSigned-off-by Vaishali Thakkar <[email protected]>---
Changes since v1:
-Edit commit log
-Merge this patch in a patch series
So in this case there is no change since v2? Maybe it would be better to make that explicit.
julia
Quoted 49 lines
drivers/staging/rtl8723au/core/rtw_ap.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/staging/rtl8723au/core/rtw_ap.c +3
-5@@ -20,6 +20,7 @@#include <wifi.h> #include <rtl8723a_cmd.h> #include <rtl8723a_hal.h> +#include <asm/unaligned.h> extern unsigned char WMM_OUI23A [];extern unsigned char WPS_OUI23A [];@@ -72,11 +73,8 @@ static void update_BCNTIM(struct rtw_adapter *padapter)struct wlan_bssid_ex *pnetwork_mlmeext = &pmlmeinfo->network;unsigned char *pie = pnetwork_mlmeext->IEs;u8 *p, *dst_ie, *premainder_ie =NULL , *pbackup_remainder_ie =NULL ; -__le16 tim_bitmap_le;uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen; - tim_bitmap_le =cpu_to_le16 (pstapriv->tim_bitmap); - p =rtw_get_ie23a (pie,WLAN_EID_TIM , &tim_ielen, pnetwork_mlmeext->IELength);if (p !=NULL && tim_ielen >0 ) {@@ -143,9 +141,9 @@ static void update_BCNTIM(struct rtw_adapter *padapter) *dst_ie++ =0 ;if (tim_ielen ==4 ) { - *dst_ie++ = *(u8 *)&tim_bitmap_le; + *dst_ie++ = pstapriv->tim_bitmap &0xff ; }else if (tim_ielen ==5 ) { -memcpy (dst_ie, &tim_bitmap_le,2 ); +put_unaligned_le16 (pstapriv->tim_bitmap, dst_ie); dst_ie +=2 ; }Signature · 8 lines
1.9.1 -- You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/9defe79e0f212c883f260e27a67bff9f9ba013ba.1424402536.git.vthakkar1994%40gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: [Outreachy kernel] [PATCH v3 2/2] Staging: rtl8723au: Use put_unaligned_le16
Quoted 39 lines · Julia Lawall
Quoted 37 lines · Vaishali Thakkar
Using byte ordering functions and then
memcpy()is risky and prone to hide errors which are hard to track down. So, this patch introduces the use of functionput_unaligned_le16which makes the code clear. Here, use of variabletim_bitmap_leand variable itself is removed. Also, to be compatible with the changes header file is added too.Coccinelle is used to do this change and semantic patch used for this is as follows:
@a@
typedef__le16;__le16e16;
identifier tmp;
expression ptr;
expression y,e;
type T;
@@- tmp =
cpu_to_le16(y);<+... when != tmp
(
-memcpy(ptr, (T)&tmp, \(2\|sizeof(__le16)\|sizeof(e16)\));
+put_unaligned_le16(y,ptr);
|
-memcpy(ptr, (T)&tmp, ...);
+put_unaligned_le16(y,ptr);
)
...+>
? tmp = e@@ type T; identifier a.tmp; @@
- T tmp;
...when != tmp
Quoted 8 lines
Quoted 5 lines
Signed-off-by Vaishali Thakkar <[email protected]>---
Changes since v1:
-Edit commit log
-Merge this patch in a patch seriesSo in this case there is no change since v2? Maybe it would be better to make that explicit.
Actually there is no v2 of this patch but as this patch is merged in a series with
v3 of patch Staging: rtl8188eu: Use put_unaligned_le16 it comes as a v3.
Should I clear this in a cover letter and then resend the patch series?
Quoted 52 lines
julia
Quoted 49 lines
drivers/staging/rtl8723au/core/rtw_ap.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/staging/rtl8723au/core/rtw_ap.c +3
-6@@ -20,6 +20,7 @@#include <wifi.h> #include <rtl8723a_cmd.h> #include <rtl8723a_hal.h> +#include <asm/unaligned.h> extern unsigned char WMM_OUI23A [];extern unsigned char WPS_OUI23A [];@@ -72,11 +73,8 @@ static void update_BCNTIM(struct rtw_adapter *padapter)struct wlan_bssid_ex *pnetwork_mlmeext = &pmlmeinfo->network;unsigned char *pie = pnetwork_mlmeext->IEs;u8 *p, *dst_ie, *premainder_ie =NULL , *pbackup_remainder_ie =NULL ; -__le16 tim_bitmap_le;uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen; - tim_bitmap_le =cpu_to_le16 (pstapriv->tim_bitmap); - p =rtw_get_ie23a (pie,WLAN_EID_TIM , &tim_ielen, pnetwork_mlmeext->IELength);if (p !=NULL && tim_ielen >0 ) {@@ -143,9 +141,9 @@ static void update_BCNTIM(struct rtw_adapter *padapter) *dst_ie++ =0 ;if (tim_ielen ==4 ) { - *dst_ie++ = *(u8 *)&tim_bitmap_le; + *dst_ie++ = pstapriv->tim_bitmap &0xff ; }else if (tim_ielen ==5 ) { -memcpy (dst_ie, &tim_bitmap_le,2 ); +put_unaligned_le16 (pstapriv->tim_bitmap, dst_ie); dst_ie +=2 ; } --1.9.1
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/9defe79e0f212c883f260e27a67bff9f9ba013ba.1424402536.git.vthakkar1994%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Signature · 1 line
Vaishali
Re: [Outreachy kernel] [PATCH v3 1/2] Staging: rtl8188eu: Use put_unaligned_le16
In reply to Vaishali ThakkarHi Vaishali,
Quoted 6 lines · Vaishali Thakkar
Using byte ordering functions and then
memcpy()is risky and prone to hide errors which are hard to track down. So, this patch introduces the use of functionput_unaligned_le16which makes the code clear. Here, use of variabletim_bitmap_leand variable itself is removed. Also, to be compatible with the changes header file is added too.
You don't really need to explain the inclusion of header files since it would be understood that it is to link the newly introduced functions in the patch. But you don't need to send out a new version just for correcting this. The patchset looks good to me.
Quoted 82 lines
Coccinelle is used to do this change and semantic patch used for this is as follows:
@a@
typedef__le16;__le16e16;
identifier tmp;
expression ptr;
expression y,e;
type T;
@@- tmp =
cpu_to_le16(y);<+... when != tmp
(
-memcpy(ptr, (T)&tmp, \(2\|sizeof(__le16)\|sizeof(e16)\));
+put_unaligned_le16(y,ptr);
|
-memcpy(ptr, (T)&tmp, ...);
+put_unaligned_le16(y,ptr);
)
...+>
? tmp = e@@ type T; identifier a.tmp; @@
- T tmp;
...when != tmpSigned-off-by Vaishali Thakkar <[email protected]>---
Changes since v2:
-Edit commit log
-Merge this patch in a patch-seriesChanges since v1:
-Remove use of variabletim_bitmap_le-Remove variabletim_bitmap_le
-Add header file to be compatible with the changes -Edit commit logdrivers/staging/rtl8188eu/core/rtw_ap.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/staging/rtl8188eu/core/rtw_ap.c +3
-5@@ -23,6 +23,7 @@#include <drv_types.h> #include <wifi.h> #include <ieee80211.h> +#include <asm/unaligned.h> #ifdef CONFIG_88EU_AP_MODE @@ -78,11 +79,8 @@ static void update_BCNTIM(struct adapter *padapter)if (true) {u8 *p, *dst_ie, *premainder_ie =NULL ;u8 *pbackup_remainder_ie =NULL ; -__le16 tim_bitmap_le;uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen; - tim_bitmap_le =cpu_to_le16 (pstapriv->tim_bitmap); - p =rtw_get_ie (pie + _FIXED_IE_LENGTH_, _TIM_IE_, &tim_ielen, pnetwork_mlmeext->IELength - _FIXED_IE_LENGTH_);if (p !=NULL && tim_ielen >0 ) { tim_ielen +=2 ;@@ -137,9 +135,9 @@ static void update_BCNTIM(struct adapter *padapter) *dst_ie++ =0 ;if (tim_ielen ==4 ) { - *dst_ie++ = *(u8 *)&tim_bitmap_le; + *dst_ie++ = pstapriv->tim_bitmap &0xff ; }else if (tim_ielen ==5 ) { -memcpy (dst_ie, &tim_bitmap_le,2 ); +put_unaligned_le16 (pstapriv->tim_bitmap, dst_ie); dst_ie +=2 ; }
Re: [Outreachy kernel] [PATCH v3 2/2] Staging: rtl8723au: Use put_unaligned_le16
In reply to Vaishali ThakkarQuoted 72 lines · Vaishali Thakkar
Using byte ordering functions and then
memcpy()is risky and prone to hide errors which are hard to track down. So, this patch introduces the use of functionput_unaligned_le16which makes the code clear. Here, use of variabletim_bitmap_leand variable itself is removed. Also, to be compatible with the changes header file is added too.Coccinelle is used to do this change and semantic patch used for this is as follows:
@a@
typedef__le16;__le16e16;
identifier tmp;
expression ptr;
expression y,e;
type T;
@@- tmp =
cpu_to_le16(y);<+... when != tmp
(
-memcpy(ptr, (T)&tmp, \(2\|sizeof(__le16)\|sizeof(e16)\));
+put_unaligned_le16(y,ptr);
|
-memcpy(ptr, (T)&tmp, ...);
+put_unaligned_le16(y,ptr);
)
...+>
? tmp = e@@ type T; identifier a.tmp; @@
- T tmp;
...when != tmpSigned-off-by Vaishali Thakkar <[email protected]>---
Changes since v1:
-Edit commit log
-Merge this patch in a patch seriesdrivers/staging/rtl8723au/core/rtw_ap.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/staging/rtl8723au/core/rtw_ap.c +1
-3@@ -20,6 +20,7 @@#include <wifi.h> #include <rtl8723a_cmd.h> #include <rtl8723a_hal.h> +#include <asm/unaligned.h> extern unsigned char WMM_OUI23A [];extern unsigned char WPS_OUI23A [];@@ -72,11 +73,8 @@ static void update_BCNTIM(struct rtw_adapter *padapter)struct wlan_bssid_ex *pnetwork_mlmeext = &pmlmeinfo->network;unsigned char *pie = pnetwork_mlmeext->IEs;u8 *p, *dst_ie, *premainder_ie =NULL , *pbackup_remainder_ie =NULL ; -__le16 tim_bitmap_le;uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen; - tim_bitmap_le =cpu_to_le16 (pstapriv->tim_bitmap); - p =rtw_get_ie23a (pie,WLAN_EID_TIM , &tim_ielen, pnetwork_mlmeext->IELength);if (p !=NULL && tim_ielen >0 ) {@@ -143,9 +141,9 @@ static void update_BCNTIM(struct rtw_adapter *padapter) *dst_ie++ =0 ;
drivers/staging/rtl8723au/core/rtw_ap.c static void update_BCNTIM(struct rtw_adapter *padapter) · line 149
Quoted 10 lines
drivers/staging/rtl8723au/core/rtw_ap.c +2
-2if (tim_ielen ==4 ) { - *dst_ie++ = *(u8 *)&tim_bitmap_le; + *dst_ie++ = pstapriv->tim_bitmap &0xff ; }else if (tim_ielen ==5 ) { -memcpy (dst_ie, &tim_bitmap_le,2 ); +put_unaligned_le16 (pstapriv->tim_bitmap, dst_ie); dst_ie +=2 ; }
Re: [Outreachy kernel] [PATCH v3 1/2] Staging: rtl8188eu: Use put_unaligned_le16
In reply to Preeti U MurthyQuoted 1 line · Preeti U Murthy
Hi Vaishali,
Hello Preeti
Quoted 8 lines · Vaishali Thakkar
Quoted 6 lines
Using byte ordering functions and then
memcpy()is risky and prone to hide errors which are hard to track down. So, this patch introduces the use of functionput_unaligned_le16which makes the code clear. Here, use of variabletim_bitmap_leand variable itself is removed. Also, to be compatible with the changes header file is added too.
Quoted 4 lines
You don't really need to explain the inclusion of header files since it would be understood that it is to link the newly introduced functions in the patch. But you don't need to send out a new version just for correcting this. The patchset looks good to me.
Ok. I will keep this in mind for next patches.
Thank You
Quoted 84 lines
Reviewed-by Preeti U Murthy <[email protected]>Quoted 82 lines
Coccinelle is used to do this change and semantic patch used for this is as follows:
@a@
typedef__le16;__le16e16;
identifier tmp;
expression ptr;
expression y,e;
type T;
@@- tmp =
cpu_to_le16(y);<+... when != tmp
(
-memcpy(ptr, (T)&tmp, \(2\|sizeof(__le16)\|sizeof(e16)\));
+put_unaligned_le16(y,ptr);
|
-memcpy(ptr, (T)&tmp, ...);
+put_unaligned_le16(y,ptr);
)
...+>
? tmp = e@@ type T; identifier a.tmp; @@
- T tmp;
...when != tmpSigned-off-by Vaishali Thakkar <[email protected]>---
Changes since v2:
-Edit commit log
-Merge this patch in a patch-seriesChanges since v1:
-Remove use of variabletim_bitmap_le-Remove variabletim_bitmap_le
-Add header file to be compatible with the changes -Edit commit logdrivers/staging/rtl8188eu/core/rtw_ap.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/staging/rtl8188eu/core/rtw_ap.c +3
-5@@ -23,6 +23,7 @@#include <drv_types.h> #include <wifi.h> #include <ieee80211.h> +#include <asm/unaligned.h> #ifdef CONFIG_88EU_AP_MODE @@ -78,11 +79,8 @@ static void update_BCNTIM(struct adapter *padapter)if (true) {u8 *p, *dst_ie, *premainder_ie =NULL ;u8 *pbackup_remainder_ie =NULL ; -__le16 tim_bitmap_le;uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen; - tim_bitmap_le =cpu_to_le16 (pstapriv->tim_bitmap); - p =rtw_get_ie (pie + _FIXED_IE_LENGTH_, _TIM_IE_, &tim_ielen, pnetwork_mlmeext->IELength - _FIXED_IE_LENGTH_);if (p !=NULL && tim_ielen >0 ) { tim_ielen +=2 ;@@ -137,9 +135,9 @@ static void update_BCNTIM(struct adapter *padapter) *dst_ie++ =0 ;if (tim_ielen ==4 ) { - *dst_ie++ = *(u8 *)&tim_bitmap_le; + *dst_ie++ = pstapriv->tim_bitmap &0xff ; }else if (tim_ielen ==5 ) { -memcpy (dst_ie, &tim_bitmap_le,2 ); +put_unaligned_le16 (pstapriv->tim_bitmap, dst_ie); dst_ie +=2 ; }
Signature · 1 line
Vaishali
Re: [Outreachy kernel] [PATCH v3 2/2] Staging: rtl8723au: Use put_unaligned_le16
In reply to Vaishali ThakkarQuoted 46 lines · Vaishali Thakkar
Quoted 45 lines · Julia Lawall
Quoted 42 lines · Vaishali Thakkar
Using byte ordering functions and then
memcpy()is risky and prone to hide errors which are hard to track down. So, this patch introduces the use of functionput_unaligned_le16which makes the code clear. Here, use of variabletim_bitmap_leand variable itself is removed. Also, to be compatible with the changes header file is added too.Coccinelle is used to do this change and semantic patch used for this is as follows:
@a@
typedef__le16;__le16e16;
identifier tmp;
expression ptr;
expression y,e;
type T;
@@- tmp =
cpu_to_le16(y);<+... when != tmp
(
-memcpy(ptr, (T)&tmp, \(2\|sizeof(__le16)\|sizeof(e16)\));
+put_unaligned_le16(y,ptr);
|
-memcpy(ptr, (T)&tmp, ...);
+put_unaligned_le16(y,ptr);
)
...+>
? tmp = e@@ type T; identifier a.tmp; @@
- T tmp;
...when != tmpSigned-off-by Vaishali Thakkar <[email protected]>---
Changes since v1:
-Edit commit log
-Merge this patch in a patch series
Quoted 8 lines
Quoted 2 lines
So in this case there is no change since v2? Maybe it would be better to make that explicit.
Actually there is no v2 of this patch but as this patch is merged in a series with
v3 of patch Staging: rtl8188eu: Useput_unaligned_le16it comes as a v3.Should I clear this in a cover letter and then resend the patch series?
Yes I would suggest that. I missed this. Additionally I would recommend in this case to not prefix any version number to the cover letter. Instead prefix the appropriate version numbers to the individual patches mentioning the changes from the previous versions.
Regards
Preeti U Murthy
Quoted 56 lines
Quoted 53 lines
julia
Quoted 49 lines
drivers/staging/rtl8723au/core/rtw_ap.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/staging/rtl8723au/core/rtw_ap.c +3
-6@@ -20,6 +20,7 @@#include <wifi.h> #include <rtl8723a_cmd.h> #include <rtl8723a_hal.h> +#include <asm/unaligned.h> extern unsigned char WMM_OUI23A [];extern unsigned char WPS_OUI23A [];@@ -72,11 +73,8 @@ static void update_BCNTIM(struct rtw_adapter *padapter)struct wlan_bssid_ex *pnetwork_mlmeext = &pmlmeinfo->network;unsigned char *pie = pnetwork_mlmeext->IEs;u8 *p, *dst_ie, *premainder_ie =NULL , *pbackup_remainder_ie =NULL ; -__le16 tim_bitmap_le;uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen; - tim_bitmap_le =cpu_to_le16 (pstapriv->tim_bitmap); - p =rtw_get_ie23a (pie,WLAN_EID_TIM , &tim_ielen, pnetwork_mlmeext->IELength);if (p !=NULL && tim_ielen >0 ) {@@ -143,9 +141,9 @@ static void update_BCNTIM(struct rtw_adapter *padapter) *dst_ie++ =0 ;if (tim_ielen ==4 ) { - *dst_ie++ = *(u8 *)&tim_bitmap_le; + *dst_ie++ = pstapriv->tim_bitmap &0xff ; }else if (tim_ielen ==5 ) { -memcpy (dst_ie, &tim_bitmap_le,2 ); +put_unaligned_le16 (pstapriv->tim_bitmap, dst_ie); dst_ie +=2 ; } --1.9.1
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/9defe79e0f212c883f260e27a67bff9f9ba013ba.1424402536.git.vthakkar1994%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Re: [Outreachy kernel] [PATCH v3 2/2] Staging: rtl8723au: Use put_unaligned_le16
Quoted 55 lines · Preeti U Murthy
Quoted 53 lines · Vaishali Thakkar
Quoted 39 lines · Julia Lawall
Quoted 37 lines · Vaishali Thakkar
Using byte ordering functions and then
memcpy()is risky and prone to hide errors which are hard to track down. So, this patch introduces the use of functionput_unaligned_le16which makes the code clear. Here, use of variabletim_bitmap_leand variable itself is removed. Also, to be compatible with the changes header file is added too.Coccinelle is used to do this change and semantic patch used for this is as follows:
@a@
typedef__le16;__le16e16;
identifier tmp;
expression ptr;
expression y,e;
type T;
@@- tmp =
cpu_to_le16(y);<+... when != tmp
(
-memcpy(ptr, (T)&tmp, \(2\|sizeof(__le16)\|sizeof(e16)\));
+put_unaligned_le16(y,ptr);
|
-memcpy(ptr, (T)&tmp, ...);
+put_unaligned_le16(y,ptr);
)
...+>
? tmp = e@@ type T; identifier a.tmp; @@
- T tmp;
...when != tmpQuoted 8 lines
Quoted 5 lines
Signed-off-by Vaishali Thakkar <[email protected]>---
Changes since v1:
-Edit commit log
-Merge this patch in a patch seriesSo in this case there is no change since v2? Maybe it would be better to make that explicit.
Actually there is no v2 of this patch but as this patch is merged in a series with
v3 of patch Staging: rtl8188eu: Useput_unaligned_le16it comes as a v3.
Quoted 6 lines
Quoted 1 line
Should I clear this in a cover letter and then resend the patch series?
Yes I would suggest that. I missed this. Additionally I would recommend in this case to not prefix any version number to the cover letter. Instead prefix the appropriate version numbers to the individual patches mentioning the changes from the previous versions.
Ok. So, in next patch-series cover letter will not have any version number and both of these patches will have v4 as I already prefixed them as v3. And for this
particular patch I should write that there is no v2 under signed off by line. Right??
Quoted 59 lines
Regards
Preeti U MurthyQuoted 56 lines
Quoted 53 lines
julia
Quoted 49 lines
drivers/staging/rtl8723au/core/rtw_ap.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/staging/rtl8723au/core/rtw_ap.c +3
-6@@ -20,6 +20,7 @@#include <wifi.h> #include <rtl8723a_cmd.h> #include <rtl8723a_hal.h> +#include <asm/unaligned.h> extern unsigned char WMM_OUI23A [];extern unsigned char WPS_OUI23A [];@@ -72,11 +73,8 @@ static void update_BCNTIM(struct rtw_adapter *padapter)struct wlan_bssid_ex *pnetwork_mlmeext = &pmlmeinfo->network;unsigned char *pie = pnetwork_mlmeext->IEs;u8 *p, *dst_ie, *premainder_ie =NULL , *pbackup_remainder_ie =NULL ; -__le16 tim_bitmap_le;uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen; - tim_bitmap_le =cpu_to_le16 (pstapriv->tim_bitmap); - p =rtw_get_ie23a (pie,WLAN_EID_TIM , &tim_ielen, pnetwork_mlmeext->IELength);if (p !=NULL && tim_ielen >0 ) {@@ -143,9 +141,9 @@ static void update_BCNTIM(struct rtw_adapter *padapter) *dst_ie++ =0 ;if (tim_ielen ==4 ) { - *dst_ie++ = *(u8 *)&tim_bitmap_le; + *dst_ie++ = pstapriv->tim_bitmap &0xff ; }else if (tim_ielen ==5 ) { -memcpy (dst_ie, &tim_bitmap_le,2 ); +put_unaligned_le16 (pstapriv->tim_bitmap, dst_ie); dst_ie +=2 ; } --1.9.1
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/9defe79e0f212c883f260e27a67bff9f9ba013ba.1424402536.git.vthakkar1994%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Signature · 1 line
Vaishali
Re: [Outreachy kernel] [PATCH v3 2/2] Staging: rtl8723au: Use put_unaligned_le16
Quoted 11 lines · Vaishali Thakkar
Quoted 5 lines
Yes I would suggest that. I missed this. Additionally I would recommend in this case to not prefix any version number to the cover letter. Instead prefix the appropriate version numbers to the individual patches mentioning the changes from the previous versions.
Ok. So, in next patch-series cover letter will not have any version number and both of these patches will have v4 as I already prefixed them as v3. And for this
particular patch I should write that there is no v2 under signed off by line. Right??
1. No version number for the cover letter.
2. Retain [PATCH v3 1/2] Staging: rtl8188eu: Use put_unaligned_le16 as v3 itself.
3. Change [PATCH v3 2/2] Staging: rtl8723au: Use put_unaligned_le16: to v2. So it would be:
[PATCH v2 2/2] Staging: rtl8723au: Use put_unaligned_le16, since it has undergone just one revision.
The reason I ask not to change the version numbers again is because there is nothing that has significantly changed from the previous versions. There will be a change only in the manner of sending patches.
So now the question is about how you indicate to the maintainer that the fresh series that you will post now is the one to be picked up. Usually under such circumstances we append RESEND to the patches.
So now you can resend the next version as mentioned in the points above but with a RESEND tag to the cover letter and patches.
Something like: [RESEND PATCH 0/2] Staging: Use put_unaligned_le16. The maintainer will thus know that this is the one to be picked up.
Regards
Preeti U Murthy
Quoted 3 lines
Quoted 3 lines
Regards
Preeti U Murthy
Re: [Outreachy kernel] [PATCH v3 2/2] Staging: rtl8723au: Use put_unaligned_le16
Quoted 25 lines · Preeti U Murthy
Quoted 11 lines · Vaishali Thakkar
Quoted 5 lines
Yes I would suggest that. I missed this. Additionally I would recommend in this case to not prefix any version number to the cover letter. Instead prefix the appropriate version numbers to the individual patches mentioning the changes from the previous versions.
Ok. So, in next patch-series cover letter will not have any version number and both of these patches will have v4 as I already prefixed them as v3. And for this
particular patch I should write that there is no v2 under signed off by line. Right??1. No version number for the cover letter.
2. Retain [PATCH v3 1/2] Staging: rtl8188eu: Useput_unaligned_le16as v3 itself.
3. Change [PATCH v3 2/2] Staging: rtl8723au: Useput_unaligned_le16: to v2. So it would be:
[PATCH v2 2/2] Staging: rtl8723au: Useput_unaligned_le16, since it has undergone just one revision.The reason I ask not to change the version numbers again is because there is nothing that has significantly changed from the previous versions. There will be a change only in the manner of sending patches.
Quoted 8 lines
So now the question is about how you indicate to the maintainer that the fresh series that you will post now is the one to be picked up. Usually under such circumstances we append RESEND to the patches.
So now you can resend the next version as mentioned in the points above but with a RESEND tag to the cover letter and patches.Something like: [RESEND PATCH 0/2] Staging: Use
put_unaligned_le16. The maintainer will thus know that this is the one to be picked up.
Yes. This makes sense. I was confused about how maintainer will know what to pick in these kind of situations. Thanks for clearing this. :)
Quoted 8 lines
Regards
Preeti U MurthyQuoted 3 lines
Quoted 3 lines
Regards
Preeti U Murthy
Signature · 1 line
Vaishali