* [PATCH] rtl8188eu: rtw_xmit: Replace rcu_dereference() with rcu_access_pointer()
@ 2014-09-04 17:15 Andreea-Cristina Bernat
2014-09-08 20:48 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Andreea-Cristina Bernat @ 2014-09-04 17:15 UTC (permalink / raw)
To: gregkh, Larry.Finger, navin.patidar, devel, linux-kernel; +Cc: paulmck
The "br_port" local variables obtained through the rcu_dereference() calls are
not dereferenced in the rest of their function.
Therefore, it is recommended to use rcu_access_pointer() instead of
rcu_dereference().
This patch makes the replacements.
The first step to detect this was made with the following Coccinelle semantic
patch:
@@
identifier p;
@@
* p = rcu_dereference(...)
... when any
when != p
(
* if( (<+...p...+>) ) { ... }
|
* while( (<+...p...+>) ) { ... }
)
... when != p
After the analysis of the output, the change was made manually.
Signed-off-by: Andreea-Cristina Bernat <bernat.ada@gmail.com>
---
drivers/staging/rtl8188eu/core/rtw_xmit.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index 1413ec8..93228dc 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -1684,7 +1684,7 @@ static int rtw_br_client_tx(struct adapter *padapter, struct sk_buff **pskb)
void *br_port = NULL;
rcu_read_lock();
- br_port = rcu_dereference(padapter->pnetdev->rx_handler_data);
+ br_port = rcu_access_pointer(padapter->pnetdev->rx_handler_data);
rcu_read_unlock();
spin_lock_bh(&padapter->br_ext_lock);
if (!(skb->data[0] & 1) && br_port &&
@@ -1868,7 +1868,7 @@ s32 rtw_xmit(struct adapter *padapter, struct sk_buff **ppkt)
}
rcu_read_lock();
- br_port = rcu_dereference(padapter->pnetdev->rx_handler_data);
+ br_port = rcu_access_pointer(padapter->pnetdev->rx_handler_data);
rcu_read_unlock();
if (br_port && check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE)) {
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] rtl8188eu: rtw_xmit: Replace rcu_dereference() with rcu_access_pointer()
2014-09-04 17:15 [PATCH] rtl8188eu: rtw_xmit: Replace rcu_dereference() with rcu_access_pointer() Andreea-Cristina Bernat
@ 2014-09-08 20:48 ` Greg KH
2014-09-09 13:22 ` Andreea Bernat
0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2014-09-08 20:48 UTC (permalink / raw)
To: Andreea-Cristina Bernat
Cc: Larry.Finger, navin.patidar, devel, linux-kernel, paulmck
On Thu, Sep 04, 2014 at 08:15:48PM +0300, Andreea-Cristina Bernat wrote:
> The "br_port" local variables obtained through the rcu_dereference() calls are
> not dereferenced in the rest of their function.
> Therefore, it is recommended to use rcu_access_pointer() instead of
> rcu_dereference().
> This patch makes the replacements.
>
> The first step to detect this was made with the following Coccinelle semantic
> patch:
> @@
> identifier p;
> @@
>
> * p = rcu_dereference(...)
> ... when any
> when != p
> (
> * if( (<+...p...+>) ) { ... }
> |
> * while( (<+...p...+>) ) { ... }
> )
> ... when != p
>
> After the analysis of the output, the change was made manually.
>
> Signed-off-by: Andreea-Cristina Bernat <bernat.ada@gmail.com>
> ---
> drivers/staging/rtl8188eu/core/rtw_xmit.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c
> index 1413ec8..93228dc 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
> @@ -1684,7 +1684,7 @@ static int rtw_br_client_tx(struct adapter *padapter, struct sk_buff **pskb)
> void *br_port = NULL;
>
> rcu_read_lock();
> - br_port = rcu_dereference(padapter->pnetdev->rx_handler_data);
> + br_port = rcu_access_pointer(padapter->pnetdev->rx_handler_data);
> rcu_read_unlock();
> spin_lock_bh(&padapter->br_ext_lock);
> if (!(skb->data[0] & 1) && br_port &&
> @@ -1868,7 +1868,7 @@ s32 rtw_xmit(struct adapter *padapter, struct sk_buff **ppkt)
> }
>
> rcu_read_lock();
> - br_port = rcu_dereference(padapter->pnetdev->rx_handler_data);
> + br_port = rcu_access_pointer(padapter->pnetdev->rx_handler_data);
> rcu_read_unlock();
>
> if (br_port && check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE)) {
This patch doesn't apply at all to my staging-next branch of the
staging.git tree on git.kernel.org :(
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rtl8188eu: rtw_xmit: Replace rcu_dereference() with rcu_access_pointer()
2014-09-08 20:48 ` Greg KH
@ 2014-09-09 13:22 ` Andreea Bernat
0 siblings, 0 replies; 3+ messages in thread
From: Andreea Bernat @ 2014-09-09 13:22 UTC (permalink / raw)
To: Greg KH; +Cc: Larry.Finger, navin patidar, devel, linux-kernel, Paul McKenney
The rcu_dereference() calls are no longer there.
They were removed.
Sorry,
Andreea
2014-09-08 23:48 GMT+03:00 Greg KH <gregkh@linuxfoundation.org>:
> On Thu, Sep 04, 2014 at 08:15:48PM +0300, Andreea-Cristina Bernat wrote:
>> The "br_port" local variables obtained through the rcu_dereference() calls are
>> not dereferenced in the rest of their function.
>> Therefore, it is recommended to use rcu_access_pointer() instead of
>> rcu_dereference().
>> This patch makes the replacements.
>>
>> The first step to detect this was made with the following Coccinelle semantic
>> patch:
>> @@
>> identifier p;
>> @@
>>
>> * p = rcu_dereference(...)
>> ... when any
>> when != p
>> (
>> * if( (<+...p...+>) ) { ... }
>> |
>> * while( (<+...p...+>) ) { ... }
>> )
>> ... when != p
>>
>> After the analysis of the output, the change was made manually.
>>
>> Signed-off-by: Andreea-Cristina Bernat <bernat.ada@gmail.com>
>> ---
>> drivers/staging/rtl8188eu/core/rtw_xmit.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c
>> index 1413ec8..93228dc 100644
>> --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
>> +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
>> @@ -1684,7 +1684,7 @@ static int rtw_br_client_tx(struct adapter *padapter, struct sk_buff **pskb)
>> void *br_port = NULL;
>>
>> rcu_read_lock();
>> - br_port = rcu_dereference(padapter->pnetdev->rx_handler_data);
>> + br_port = rcu_access_pointer(padapter->pnetdev->rx_handler_data);
>> rcu_read_unlock();
>> spin_lock_bh(&padapter->br_ext_lock);
>> if (!(skb->data[0] & 1) && br_port &&
>> @@ -1868,7 +1868,7 @@ s32 rtw_xmit(struct adapter *padapter, struct sk_buff **ppkt)
>> }
>>
>> rcu_read_lock();
>> - br_port = rcu_dereference(padapter->pnetdev->rx_handler_data);
>> + br_port = rcu_access_pointer(padapter->pnetdev->rx_handler_data);
>> rcu_read_unlock();
>>
>> if (br_port && check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE)) {
>
> This patch doesn't apply at all to my staging-next branch of the
> staging.git tree on git.kernel.org :(
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-09-09 13:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-04 17:15 [PATCH] rtl8188eu: rtw_xmit: Replace rcu_dereference() with rcu_access_pointer() Andreea-Cristina Bernat
2014-09-08 20:48 ` Greg KH
2014-09-09 13:22 ` Andreea Bernat
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.