public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: vt6656: Use ether_addr_copy() in vnt_fill_ieee80211_rts.
@ 2014-12-08 11:13 Krzysztof Adamski
  0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Adamski @ 2014-12-08 11:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Malcolm Priestley; +Cc: devel, linux-kernel

Both struct ieee80211_rts and struct ieee80211_hdr defined in
linux/ieee80211.h are declared as __aligned(2) so it is safe to use
ether_addr_copy() instead of memcpy().

Signed-off-by: Krzysztof Adamski <k@japko.eu>
---
 drivers/staging/vt6656/rxtx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index ea5140a..280c923 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -36,6 +36,7 @@
  *
  */
 
+#include <linux/etherdevice.h>
 #include "device.h"
 #include "rxtx.h"
 #include "card.h"
@@ -392,8 +393,8 @@ static int vnt_fill_ieee80211_rts(struct vnt_usb_send_context *tx_context,
 	rts->frame_control =
 		cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS);
 
-	memcpy(rts->ra, hdr->addr1, ETH_ALEN);
-	memcpy(rts->ta, hdr->addr2, ETH_ALEN);
+	ether_addr_copy(rts->ra, hdr->addr1);
+	ether_addr_copy(rts->ta, hdr->addr2);
 
 	return 0;
 }
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] staging: vt6656: Use ether_addr_copy() in vnt_fill_ieee80211_rts.
@ 2014-12-16  8:30 Krzysztof Adamski
  2014-12-16  8:42 ` Joe Perches
  2015-01-13  3:37 ` Greg Kroah-Hartman
  0 siblings, 2 replies; 5+ messages in thread
From: Krzysztof Adamski @ 2014-12-16  8:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Malcolm Priestley, Forest Bond; +Cc: devel, linux-kernel

Both struct ieee80211_rts and struct ieee80211_hdr defined in
linux/ieee80211.h are declared as __aligned(2) so it is safe to use
ether_addr_copy() instead of memcpy().

Signed-off-by: Krzysztof Adamski <k@japko.eu>
---
  drivers/staging/vt6656/rxtx.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index ea5140a..280c923 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -36,6 +36,7 @@
   *
   */
  
+#include <linux/etherdevice.h>
  #include "device.h"
  #include "rxtx.h"
  #include "card.h"
@@ -392,8 +393,8 @@ static int vnt_fill_ieee80211_rts(struct vnt_usb_send_context *tx_context,
  	rts->frame_control =
  		cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS);
  
-	memcpy(rts->ra, hdr->addr1, ETH_ALEN);
-	memcpy(rts->ta, hdr->addr2, ETH_ALEN);
+	ether_addr_copy(rts->ra, hdr->addr1);
+	ether_addr_copy(rts->ta, hdr->addr2);
  
  	return 0;
  }
-- 
1.9.3

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] staging: vt6656: Use ether_addr_copy() in vnt_fill_ieee80211_rts.
  2014-12-16  8:30 [PATCH] staging: vt6656: Use ether_addr_copy() in vnt_fill_ieee80211_rts Krzysztof Adamski
@ 2014-12-16  8:42 ` Joe Perches
  2014-12-16  8:53   ` Krzysztof Adamski
  2015-01-13  3:37 ` Greg Kroah-Hartman
  1 sibling, 1 reply; 5+ messages in thread
From: Joe Perches @ 2014-12-16  8:42 UTC (permalink / raw)
  To: Krzysztof Adamski
  Cc: Greg Kroah-Hartman, Malcolm Priestley, Forest Bond, devel,
	linux-kernel

On Tue, 2014-12-16 at 09:30 +0100, Krzysztof Adamski wrote:
> Both struct ieee80211_rts and struct ieee80211_hdr defined in
> linux/ieee80211.h are declared as __aligned(2) so it is safe to use
> ether_addr_copy() instead of memcpy().

Just fyi:

That the structure is declared __aligned(2) is not
the important bit.  What's necessary is that the
members in the struct are __aligned(2).

In this case, all of these members are.

> diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
[]
> @@ -392,8 +393,8 @@ static int vnt_fill_ieee80211_rts(struct vnt_usb_send_context *tx_context,
>   	rts->frame_control =
>   		cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS);
>   
> -	memcpy(rts->ra, hdr->addr1, ETH_ALEN);
> -	memcpy(rts->ta, hdr->addr2, ETH_ALEN);
> +	ether_addr_copy(rts->ra, hdr->addr1);
> +	ether_addr_copy(rts->ta, hdr->addr2);




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] staging: vt6656: Use ether_addr_copy() in vnt_fill_ieee80211_rts.
  2014-12-16  8:42 ` Joe Perches
@ 2014-12-16  8:53   ` Krzysztof Adamski
  0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Adamski @ 2014-12-16  8:53 UTC (permalink / raw)
  To: Joe Perches
  Cc: Greg Kroah-Hartman, Malcolm Priestley, Forest Bond, devel,
	linux-kernel

On Tue, Dec 16, 2014 at 12:42:06AM -0800, Joe Perches wrote:
>On Tue, 2014-12-16 at 09:30 +0100, Krzysztof Adamski wrote:
>> Both struct ieee80211_rts and struct ieee80211_hdr defined in
>> linux/ieee80211.h are declared as __aligned(2) so it is safe to use
>> ether_addr_copy() instead of memcpy().
>
>Just fyi:
>
>That the structure is declared __aligned(2) is not
>the important bit.  What's necessary is that the
>members in the struct are __aligned(2).
>
>In this case, all of these members are.

Hi,

Thank you for your feedback. Yes, you are right. It was a bit of a 
shortcut in my reasoning.  Since struct is aligned and it's packed and 
both members preceding the array we want to copy are 16 bit large, the 
array address is guaranteed to be properly aligned.

Best regards,
Krzysztof Adamski

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] staging: vt6656: Use ether_addr_copy() in vnt_fill_ieee80211_rts.
  2014-12-16  8:30 [PATCH] staging: vt6656: Use ether_addr_copy() in vnt_fill_ieee80211_rts Krzysztof Adamski
  2014-12-16  8:42 ` Joe Perches
@ 2015-01-13  3:37 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2015-01-13  3:37 UTC (permalink / raw)
  To: Krzysztof Adamski; +Cc: Malcolm Priestley, Forest Bond, devel, linux-kernel

On Tue, Dec 16, 2014 at 09:30:21AM +0100, Krzysztof Adamski wrote:
> Both struct ieee80211_rts and struct ieee80211_hdr defined in
> linux/ieee80211.h are declared as __aligned(2) so it is safe to use
> ether_addr_copy() instead of memcpy().
> 
> Signed-off-by: Krzysztof Adamski <k@japko.eu>
> ---
>   drivers/staging/vt6656/rxtx.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
> index ea5140a..280c923 100644
> --- a/drivers/staging/vt6656/rxtx.c
> +++ b/drivers/staging/vt6656/rxtx.c
> @@ -36,6 +36,7 @@
>    *
>    */
>   
> +#include <linux/etherdevice.h>
>   #include "device.h"
>   #include "rxtx.h"
>   #include "card.h"

Something corrupted this patch :(


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-01-13  5:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-16  8:30 [PATCH] staging: vt6656: Use ether_addr_copy() in vnt_fill_ieee80211_rts Krzysztof Adamski
2014-12-16  8:42 ` Joe Perches
2014-12-16  8:53   ` Krzysztof Adamski
2015-01-13  3:37 ` Greg Kroah-Hartman
  -- strict thread matches above, loose matches on Subject: below --
2014-12-08 11:13 Krzysztof Adamski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox