drivers: staging: rtl8712: Use ether_addr_copy() over memcpy()
PATCH 2/2 drivers: staging: rtl8712: Use ether_addr_copy() over memcpy()
Waring is removed by using ether_addr_copy() over memcpy().
WARNING: Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)
--- drivers/staging/rtl8712/rtl871x_recv.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/rtl8712/rtl871x_recv.c +5 -5
@@ -358,11 +358,11 @@ static sint sta2sta_data_frame(struct _adapter *adapter, sta_addr = pattrib->src; } }else if (check_fwstate (pmlmepriv,WIFI_MP_STATE )) { -memcpy (pattrib->dst,GetAddr1Ptr (ptr),ETH_ALEN ); -memcpy (pattrib->src,GetAddr2Ptr (ptr),ETH_ALEN ); -memcpy (pattrib->bssid,GetAddr3Ptr (ptr),ETH_ALEN ); -memcpy (pattrib->ra, pattrib->dst,ETH_ALEN ); -memcpy (pattrib->ta, pattrib->src,ETH_ALEN ); +ether_addr_copy (pattrib->dst,GetAddr1Ptr (ptr)); +ether_addr_copy (pattrib->src,GetAddr2Ptr (ptr)); +ether_addr_copy (pattrib->bssid,GetAddr3Ptr (ptr)); +ether_addr_copy (pattrib->ra, pattrib->dst); +ether_addr_copy (pattrib->ta, pattrib->src); sta_addr = mybssid; }else { ret = _FAIL;
Signature · 1 line
1.9.1
Quoted 3 lines · Rakhi Sharma
Waring is removed by using
ether_addr_copy()overmemcpy().
WARNING: Preferether_addr_copy()overmemcpy()if the Ethernet addresses are__aligned(2)
You need to show that the addresses concerned actually are aligned.
julia
Quoted 36 lines
Signed-off-by Rakhi Sharma <[email protected]>--- drivers/staging/rtl8712/rtl871x_recv.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/staging/rtl8712/rtl871x_recv.c +5
-6@@ -358,11 +358,11 @@ static sint sta2sta_data_frame(struct _adapter *adapter, sta_addr = pattrib->src; } }else if (check_fwstate (pmlmepriv,WIFI_MP_STATE )) { -memcpy (pattrib->dst,GetAddr1Ptr (ptr),ETH_ALEN ); -memcpy (pattrib->src,GetAddr2Ptr (ptr),ETH_ALEN ); -memcpy (pattrib->bssid,GetAddr3Ptr (ptr),ETH_ALEN ); -memcpy (pattrib->ra, pattrib->dst,ETH_ALEN ); -memcpy (pattrib->ta, pattrib->src,ETH_ALEN ); +ether_addr_copy (pattrib->dst,GetAddr1Ptr (ptr)); +ether_addr_copy (pattrib->src,GetAddr2Ptr (ptr)); +ether_addr_copy (pattrib->bssid,GetAddr3Ptr (ptr)); +ether_addr_copy (pattrib->ra, pattrib->dst); +ether_addr_copy (pattrib->ta, pattrib->src); sta_addr = mybssid; }else { ret = _FAIL; --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/1455107239-16386-1-git-send-email-rakhish1994%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Quoted 59 lines · Julia Lawall
Quoted 2 lines · Rakhi Sharma
Waring is removed by using
ether_addr_copy()overmemcpy().
WARNING: Preferether_addr_copy()overmemcpy()if the Ethernetaddresses are
Quoted 1 line
__aligned(2)You need to show that the addresses concerned actually are aligned.
julia
Hi, Will you please give me a little hint how I do this?
Review
Quoted 6 lines
Signed-off-by Rakhi Sharma <[email protected]>--- drivers/staging/rtl8712/rtl871x_recv.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)(quoted diff) +0
-0
b/drivers/staging/rtl8712/rtl871x_recv.cdrivers/staging/rtl8712/rtl871x_recv.c static sint sta2sta_data_frame(struct _adapter
Quoted 4 lines
index 4ff5301..2d5231a 100644
drivers/staging/rtl8712/rtl871x_recv.c +0
-0@@ -358,11 +358,11 @@ static sint sta2sta_data_frame(struct _adapter*adapter,
Quoted 19 lines
drivers/staging/rtl8712/rtl871x_recv.c +5
-6sta_addr = pattrib->src; } }else if (check_fwstate (pmlmepriv,WIFI_MP_STATE )) { -memcpy (pattrib->dst,GetAddr1Ptr (ptr),ETH_ALEN ); -memcpy (pattrib->src,GetAddr2Ptr (ptr),ETH_ALEN ); -memcpy (pattrib->bssid,GetAddr3Ptr (ptr),ETH_ALEN ); -memcpy (pattrib->ra, pattrib->dst,ETH_ALEN ); -memcpy (pattrib->ta, pattrib->src,ETH_ALEN ); +ether_addr_copy (pattrib->dst,GetAddr1Ptr (ptr)); +ether_addr_copy (pattrib->src,GetAddr2Ptr (ptr)); +ether_addr_copy (pattrib->bssid,GetAddr3Ptr (ptr)); +ether_addr_copy (pattrib->ra, pattrib->dst); +ether_addr_copy (pattrib->ta, pattrib->src); sta_addr = mybssid; }else { ret = _FAIL; --1.9.1
Quoted 2 lines
--
You received this message because you are subscribed to the GoogleGroups "outreachy-kernel" group.
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
Quoted 2 lines
To post to this group, send email to [email protected]. To view this discussion on the web visit
Quoted 2 lines
For more options, visit https://groups.google.com/d/optout.
Quoted 12 lines · RAKHI SHARMA
On Wed, Feb 10, 2016 at 6:32 PM, Julia Lawall <[email protected]> wrote:
On Wed, 10 Feb 2016, Rakhi Sharma wrote:
> Waring is removed by using
ether_addr_copy()overmemcpy(). > WARNING: Preferether_addr_copy()overmemcpy()if the Ethernet addresses are
>__aligned(2)
Quoted 6 lines
You need to show that the addresses concerned actually are aligned.
julia
Hi, Will you please give me a little hint how I do this?
Sorry, I meant to do that :) There is a tool called pahole that you can use for this purpose. You can also search through the git logs for ether_addr_copy to see how others have justified this change.
julia
Quoted 59 lines
> Signed-off-by: Rakhi Sharma <[email protected]> > --- > drivers/staging/rtl8712/rtl871x_recv.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/staging/rtl8712/rtl871x_recv.c b/drivers/staging/rtl8712/rtl871x_recv.c > index 4ff5301..2d5231a 100644 > --- a/drivers/staging/rtl8712/rtl871x_recv.c > +++ b/drivers/staging/rtl8712/rtl871x_recv.c > @@ -358,11 +358,11 @@ static sint sta2sta_data_frame(struct _adapter *adapter, > sta_addr = pattrib->src; > } > } else if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) { > - memcpy(pattrib->dst, GetAddr1Ptr(ptr), ETH_ALEN); > - memcpy(pattrib->src, GetAddr2Ptr(ptr), ETH_ALEN); > - memcpy(pattrib->bssid, GetAddr3Ptr(ptr), ETH_ALEN); > - memcpy(pattrib->ra, pattrib->dst, ETH_ALEN); > - memcpy(pattrib->ta, pattrib->src, ETH_ALEN); > + ether_addr_copy(pattrib->dst, GetAddr1Ptr(ptr)); > + ether_addr_copy(pattrib->src, GetAddr2Ptr(ptr)); > + ether_addr_copy(pattrib->bssid, GetAddr3Ptr(ptr)); > + ether_addr_copy(pattrib->ra, pattrib->dst); > + ether_addr_copy(pattrib->ta, pattrib->src); > sta_addr = mybssid; > } else { > ret = _FAIL; > -- > 1.9.1 >Quoted 2 lines
--
You received this message because you are subscribed to the GoogleGroups "outreachy-kernel" group.
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it,
send an email to [email protected].
Quoted 1 line
To post to this group, send email to
Quoted 1 line
To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/1455107239-16386-1-git-s
end-email-rakhish1994%40gmail.com.
Quoted 2 lines
For more options, visit https://groups.google.com/d/optout.
--
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 visithttps://groups.google.com/d/msgid/outreachy-kernel/CAMnyiXu%3DswBQdGVc%2BdQ 6sCuZ37d7XWi6bh%2B8Q_cyfRug6VpJkw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.