Skip to contentSkip to conversation

staging: vt6656: replace memcpy by ether_addr_copy

PATCH Superseded Aya Mahfouz 4 participants 13 messages Feb 17, 2015 – Feb 27, 2015 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: vt6656: replace memcpy by ether_addr_copy

This patch fixes the following checkpatch.pl warning:

Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)

The changes were applied using the following coccinelle rule:
@@ expression e1, e2; @@
- memcpy(e1, e2, ETH_ALEN);
+ ether_addr_copy(e1, e2);

All variables defined in vnt_mac_set_key start at even offsets making the variables aligned to the u16 datatype.

---
 drivers/staging/vt6656/mac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6656/mac.c +1 -1
index bb37e33..5958ecf 100644
@@ -126,7 +126,7 @@ void vnt_mac_set_keyentry(struct vnt_private *priv, u16 key_ctl, u32 entry_idx,
 	offset += (entry_idx * MISCFIFO_KEYENTRYSIZE);
 
 	set_key.u.write.key_ctl = cpu_to_le16(key_ctl);
-	memcpy(set_key.u.write.addr, addr, ETH_ALEN);
+	ether_addr_copy(set_key.u.write.addr, addr);
 
 	/* swap over swap[0] and swap[1] to get correct write order */
 	swap(set_key.u.swap[0], set_key.u.swap[1]);
Signature · 1 line
1.9.3
maintainer
#1 lore raw
Quoted 24 lines · Aya Mahfouz

This patch fixes the following checkpatch.pl warning:

Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)

The changes were applied using the following coccinelle rule:
@@ expression e1, e2; @@
- memcpy(e1, e2, ETH_ALEN);
+ ether_addr_copy(e1, e2);

All variables defined in vnt_mac_set_key start at even offsets making the variables aligned to the u16 datatype.

---
 drivers/staging/vt6656/mac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6656/mac.c +0 -0
index bb37e33..5958ecf 100644

drivers/staging/vt6656/mac.c void vnt_mac_set_keyentry(struct vnt_private *priv, u16 key_ctl, u32 entry_idx, · line 132

Quoted 8 lines
drivers/staging/vt6656/mac.c +1 -1
@@ -126,7 +126,7 @@ void vnt_mac_set_keyentry(struct vnt_private *priv, u16 key_ctl, u32 entry_idx,
 	offset += (entry_idx * MISCFIFO_KEYENTRYSIZE);
 
 	set_key.u.write.key_ctl = cpu_to_le16(key_ctl);
-	memcpy(set_key.u.write.addr, addr, ETH_ALEN);
+	ether_addr_copy(set_key.u.write.addr, addr);
 
 	/* swap over swap[0] and swap[1] to get correct write order */
 	swap(set_key.u.swap[0], set_key.u.swap[1]);

This patch breaks the build, please _always_ test build your patches :(

thanks,

greg k-h

#2 lore raw
Quoted 31 lines · Greg KH
Quoted 30 lines · Aya Mahfouz

This patch fixes the following checkpatch.pl warning:

Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)

The changes were applied using the following coccinelle rule:
@@ expression e1, e2; @@
- memcpy(e1, e2, ETH_ALEN);
+ ether_addr_copy(e1, e2);

All variables defined in vnt_mac_set_key start at even offsets making the variables aligned to the u16 datatype.

---
 drivers/staging/vt6656/mac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6656/mac.c +1 -1
index bb37e33..5958ecf 100644
@@ -126,7 +126,7 @@ void vnt_mac_set_keyentry(struct vnt_private *priv, u16 key_ctl, u32 entry_idx,
 	offset += (entry_idx * MISCFIFO_KEYENTRYSIZE);
 
 	set_key.u.write.key_ctl = cpu_to_le16(key_ctl);
-	memcpy(set_key.u.write.addr, addr, ETH_ALEN);
+	ether_addr_copy(set_key.u.write.addr, addr);
 
Quoted 8 lines

drivers/staging/vt6656/mac.c void vnt_mac_set_keyentry(struct vnt_private *priv, u16 key_ctl, u32 entry_idx, · line 132

Quoted 2 lines
drivers/staging/vt6656/mac.c +0 -0
 	/* swap over swap[0] and swap[1] to get correct write order */
 	swap(set_key.u.swap[0], set_key.u.swap[1]);

This patch breaks the build, please _always_ test build your patches :(

thanks,

greg k-h

Hello Greg,

I always do and I didn't get any warnings or erros when building it before sending. If you have the time, please let me know what is the error.

It also seems to be that you compile all warnings as errors, it would be kind of you if you let me know your build settings.

Signature · 2 lines
Kind Regards,
Aya Saif El-yazal Mahfouz
#3 lore raw
Quoted 41 lines · Aya Mahfouz
Quoted 31 lines · Greg KH
Quoted 30 lines · Aya Mahfouz

This patch fixes the following checkpatch.pl warning:

Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)

The changes were applied using the following coccinelle rule:
@@ expression e1, e2; @@
- memcpy(e1, e2, ETH_ALEN);
+ ether_addr_copy(e1, e2);

All variables defined in vnt_mac_set_key start at even offsets making the variables aligned to the u16 datatype.

---
 drivers/staging/vt6656/mac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6656/mac.c +1 -1
index bb37e33..5958ecf 100644
@@ -126,7 +126,7 @@ void vnt_mac_set_keyentry(struct vnt_private *priv, u16 key_ctl, u32 entry_idx,
 	offset += (entry_idx * MISCFIFO_KEYENTRYSIZE);
 
 	set_key.u.write.key_ctl = cpu_to_le16(key_ctl);
-	memcpy(set_key.u.write.addr, addr, ETH_ALEN);
+	ether_addr_copy(set_key.u.write.addr, addr);
 
Quoted 8 lines

drivers/staging/vt6656/mac.c void vnt_mac_set_keyentry(struct vnt_private *priv, u16 key_ctl, u32 entry_idx, · line 132

Quoted 2 lines
drivers/staging/vt6656/mac.c +0 -0
 	/* swap over swap[0] and swap[1] to get correct write order */
 	swap(set_key.u.swap[0], set_key.u.swap[1]);

This patch breaks the build, please _always_ test build your patches :(

thanks,

greg k-h

Quoted 8 lines

Hello Greg,

I always do and I didn't get any warnings or erros when building it before sending. If you have the time, please let me know what is the error.

It also seems to be that you compile all warnings as errors, it would be kind of you if you let me know your build settings.

Are you sure that you have a .o file for this file?

julia

#4 lore raw
Quoted 49 lines · Julia Lawall
Quoted 47 lines · Aya Mahfouz
Quoted 31 lines · Greg KH
Quoted 30 lines · Aya Mahfouz

This patch fixes the following checkpatch.pl warning:

Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)

The changes were applied using the following coccinelle rule:
@@ expression e1, e2; @@
- memcpy(e1, e2, ETH_ALEN);
+ ether_addr_copy(e1, e2);

All variables defined in vnt_mac_set_key start at even offsets making the variables aligned to the u16 datatype.

---
 drivers/staging/vt6656/mac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6656/mac.c +1 -1
index bb37e33..5958ecf 100644
@@ -126,7 +126,7 @@ void vnt_mac_set_keyentry(struct vnt_private *priv, u16 key_ctl, u32 entry_idx,
 	offset += (entry_idx * MISCFIFO_KEYENTRYSIZE);
 
 	set_key.u.write.key_ctl = cpu_to_le16(key_ctl);
-	memcpy(set_key.u.write.addr, addr, ETH_ALEN);
+	ether_addr_copy(set_key.u.write.addr, addr);
 
Quoted 8 lines

drivers/staging/vt6656/mac.c void vnt_mac_set_keyentry(struct vnt_private *priv, u16 key_ctl, u32 entry_idx, · line 132

Quoted 2 lines
drivers/staging/vt6656/mac.c +0 -0
 	/* swap over swap[0] and swap[1] to get correct write order */
 	swap(set_key.u.swap[0], set_key.u.swap[1]);

This patch breaks the build, please _always_ test build your patches :(

thanks,

greg k-h

Hello Greg,

I always do and I didn't get any warnings or erros when building it before sending. If you have the time, please let me know what is the error.

Quoted 6 lines
Quoted 2 lines

It also seems to be that you compile all warnings as errors, it would be kind of you if you let me know your build settings.

Are you sure that you have a .o file for this file?

julia

I'm rebuilding the kernel now. I will let you know once I'm done.

Signature · 2 lines
Kind Regards,
Aya Saif El-yazal Mahfouz
maintainer
#5 lore raw
In reply to Aya Mahfouz
Quoted 39 lines · Aya Mahfouz
Quoted 38 lines · Greg KH
Quoted 24 lines · Aya Mahfouz

This patch fixes the following checkpatch.pl warning:

Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)

The changes were applied using the following coccinelle rule:
@@ expression e1, e2; @@
- memcpy(e1, e2, ETH_ALEN);
+ ether_addr_copy(e1, e2);

All variables defined in vnt_mac_set_key start at even offsets making the variables aligned to the u16 datatype.

---
 drivers/staging/vt6656/mac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6656/mac.c +0 -0
index bb37e33..5958ecf 100644

drivers/staging/vt6656/mac.c void vnt_mac_set_keyentry(struct vnt_private *priv, u16 key_ctl, u32 entry_idx, · line 132

Quoted 8 lines
drivers/staging/vt6656/mac.c +1 -1
@@ -126,7 +126,7 @@ void vnt_mac_set_keyentry(struct vnt_private *priv, u16 key_ctl, u32 entry_idx,
 	offset += (entry_idx * MISCFIFO_KEYENTRYSIZE);
 
 	set_key.u.write.key_ctl = cpu_to_le16(key_ctl);
-	memcpy(set_key.u.write.addr, addr, ETH_ALEN);
+	ether_addr_copy(set_key.u.write.addr, addr);
 
 	/* swap over swap[0] and swap[1] to get correct write order */
 	swap(set_key.u.swap[0], set_key.u.swap[1]);

This patch breaks the build, please _always_ test build your patches :(

thanks,

Quoted 7 lines
Quoted 1 line

greg k-h

Hello Greg,

I always do and I didn't get any warnings or erros when building it before sending. If you have the time, please let me know what is the error.

The compiler does not know what ether_addr_copy() is.

Quoted 2 lines

It also seems to be that you compile all warnings as errors, it would be kind of you if you let me know your build settings.

I am building a "normal" x86-64 kernel with this driver enabled. And no, I am not treating warnings as errors, but your patches should never be adding build warnings, that is not allowed either.

thanks,

greg k-h

#6 lore raw
Quoted 48 lines · Greg KH
Quoted 39 lines · Aya Mahfouz
Quoted 38 lines · Greg KH
Quoted 24 lines · Aya Mahfouz

This patch fixes the following checkpatch.pl warning:

Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)

The changes were applied using the following coccinelle rule:
@@ expression e1, e2; @@
- memcpy(e1, e2, ETH_ALEN);
+ ether_addr_copy(e1, e2);

All variables defined in vnt_mac_set_key start at even offsets making the variables aligned to the u16 datatype.

---
 drivers/staging/vt6656/mac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6656/mac.c +0 -0
index bb37e33..5958ecf 100644

drivers/staging/vt6656/mac.c void vnt_mac_set_keyentry(struct vnt_private *priv, u16 key_ctl, u32 entry_idx, · line 132

Quoted 8 lines
drivers/staging/vt6656/mac.c +1 -1
@@ -126,7 +126,7 @@ void vnt_mac_set_keyentry(struct vnt_private *priv, u16 key_ctl, u32 entry_idx,
 	offset += (entry_idx * MISCFIFO_KEYENTRYSIZE);
 
 	set_key.u.write.key_ctl = cpu_to_le16(key_ctl);
-	memcpy(set_key.u.write.addr, addr, ETH_ALEN);
+	ether_addr_copy(set_key.u.write.addr, addr);
 
 	/* swap over swap[0] and swap[1] to get correct write order */
 	swap(set_key.u.swap[0], set_key.u.swap[1]);

This patch breaks the build, please _always_ test build your patches :(

thanks,

Quoted 7 lines
Quoted 1 line

greg k-h

Hello Greg,

I always do and I didn't get any warnings or erros when building it before sending. If you have the time, please let me know what is the error.

Quoted 9 lines

The compiler does not know what ether_addr_copy() is.

Quoted 2 lines

It also seems to be that you compile all warnings as errors, it would be kind of you if you let me know your build settings.

I am building a "normal" x86-64 kernel with this driver enabled. And no, I am not treating warnings as errors, but your patches should never be adding build warnings, that is not allowed either.

Yes, concerning warnings, you told me that before. It seems to me that I'm compiling the modules in a wrong way. I usually use one of the following commands, if compiling a module:

make -C $pwd SUBDIRS=drivers/staging/xxx modules
make M=drivers/staging/xxx

The .o files were generated only after I broke the whole kernel build, otherwise nothing is generated.

Any remedies?

Quoted 3 lines

thanks,

greg k-h

Signature · 2 lines
Kind Regards,
Aya Saif El-yazal Mahfouz
maintainer
#7 lore raw
Quoted 59 lines · Aya Mahfouz
Quoted 48 lines · Greg KH
Quoted 39 lines · Aya Mahfouz
Quoted 38 lines · Greg KH
Quoted 24 lines · Aya Mahfouz

This patch fixes the following checkpatch.pl warning:

Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)

The changes were applied using the following coccinelle rule:
@@ expression e1, e2; @@
- memcpy(e1, e2, ETH_ALEN);
+ ether_addr_copy(e1, e2);

All variables defined in vnt_mac_set_key start at even offsets making the variables aligned to the u16 datatype.

---
 drivers/staging/vt6656/mac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6656/mac.c +0 -0
index bb37e33..5958ecf 100644

drivers/staging/vt6656/mac.c void vnt_mac_set_keyentry(struct vnt_private *priv, u16 key_ctl, u32 entry_idx, · line 132

Quoted 8 lines
drivers/staging/vt6656/mac.c +1 -1
@@ -126,7 +126,7 @@ void vnt_mac_set_keyentry(struct vnt_private *priv, u16 key_ctl, u32 entry_idx,
 	offset += (entry_idx * MISCFIFO_KEYENTRYSIZE);
 
 	set_key.u.write.key_ctl = cpu_to_le16(key_ctl);
-	memcpy(set_key.u.write.addr, addr, ETH_ALEN);
+	ether_addr_copy(set_key.u.write.addr, addr);
 
 	/* swap over swap[0] and swap[1] to get correct write order */
 	swap(set_key.u.swap[0], set_key.u.swap[1]);

This patch breaks the build, please _always_ test build your patches :(

thanks,

Quoted 7 lines
Quoted 1 line

greg k-h

Hello Greg,

I always do and I didn't get any warnings or erros when building it before sending. If you have the time, please let me know what is the error.

Quoted 9 lines

The compiler does not know what ether_addr_copy() is.

Quoted 2 lines

It also seems to be that you compile all warnings as errors, it would be kind of you if you let me know your build settings.

I am building a "normal" x86-64 kernel with this driver enabled. And no, I am not treating warnings as errors, but your patches should never be adding build warnings, that is not allowed either.

Quoted 6 lines

Yes, concerning warnings, you told me that before. It seems to me that I'm compiling the modules in a wrong way. I usually use one of the following commands, if compiling a module:

make -C $pwd SUBDIRS=drivers/staging/xxx modules
make M=drivers/staging/xxx

Both of those should work.

Quoted 4 lines

The .o files were generated only after I broke the whole kernel build, otherwise nothing is generated.

Any remedies?

I don't understand, what exactly was the errors?

It's usually just easiest to build the whole tree, you can do it quicker by doing:

	make -j16

replace the number with 2x the number of cpus you have, and you should be fine.

good luck,

greg k-h

#8 lore raw
Quoted 78 lines · Greg KH
Quoted 59 lines · Aya Mahfouz
Quoted 48 lines · Greg KH
Quoted 39 lines · Aya Mahfouz
Quoted 38 lines · Greg KH
Quoted 24 lines · Aya Mahfouz

This patch fixes the following checkpatch.pl warning:

Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)

The changes were applied using the following coccinelle rule:
@@ expression e1, e2; @@
- memcpy(e1, e2, ETH_ALEN);
+ ether_addr_copy(e1, e2);

All variables defined in vnt_mac_set_key start at even offsets making the variables aligned to the u16 datatype.

---
 drivers/staging/vt6656/mac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6656/mac.c +0 -0
index bb37e33..5958ecf 100644

drivers/staging/vt6656/mac.c void vnt_mac_set_keyentry(struct vnt_private *priv, u16 key_ctl, u32 entry_idx, · line 132

Quoted 8 lines
drivers/staging/vt6656/mac.c +1 -1
@@ -126,7 +126,7 @@ void vnt_mac_set_keyentry(struct vnt_private *priv, u16 key_ctl, u32 entry_idx,
 	offset += (entry_idx * MISCFIFO_KEYENTRYSIZE);
 
 	set_key.u.write.key_ctl = cpu_to_le16(key_ctl);
-	memcpy(set_key.u.write.addr, addr, ETH_ALEN);
+	ether_addr_copy(set_key.u.write.addr, addr);
 
 	/* swap over swap[0] and swap[1] to get correct write order */
 	swap(set_key.u.swap[0], set_key.u.swap[1]);

This patch breaks the build, please _always_ test build your patches :(

thanks,

Quoted 7 lines
Quoted 1 line

greg k-h

Hello Greg,

I always do and I didn't get any warnings or erros when building it before sending. If you have the time, please let me know what is the error.

Quoted 9 lines

The compiler does not know what ether_addr_copy() is.

Quoted 2 lines

It also seems to be that you compile all warnings as errors, it would be kind of you if you let me know your build settings.

I am building a "normal" x86-64 kernel with this driver enabled. And no, I am not treating warnings as errors, but your patches should never be adding build warnings, that is not allowed either.

Quoted 6 lines

Yes, concerning warnings, you told me that before. It seems to me that I'm compiling the modules in a wrong way. I usually use one of the following commands, if compiling a module:

make -C $pwd SUBDIRS=drivers/staging/xxx modules
make M=drivers/staging/xxx

Both of those should work.

Quoted 4 lines

The .o files were generated only after I broke the whole kernel build, otherwise nothing is generated.

Any remedies?

I don't understand, what exactly was the errors?

It's usually just easiest to build the whole tree, you can do it quicker by doing:

Quoted 8 lines
	make -j16

replace the number with 2x the number of cpus you have, and you should be fine.

good luck,

greg k-h

ok, Thanks!

Signature · 2 lines
Kind Regards,
Aya Saif El-yazal Mahfouz
#9 lore raw
Quoted 4 lines
Quoted 4 lines

It's usually just easiest to build the whole tree, you can do it quicker by doing:

	make -j16
Quoted 8 lines
Quoted 6 lines

replace the number with 2x the number of cpus you have, and you should be fine.

good luck,

greg k-h

ok, Thanks!

I guess that the problem would have been seen by just compiling make foo/bar/file.o?

julia

#10 lore raw
Quoted 7 lines · Julia Lawall
Quoted 7 lines
Quoted 7 lines

It's usually just easiest to build the whole tree, you can do it quicker by doing:

	make -j16

replace the number with 2x the number of cpus you have, and you should be fine.

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

good luck,

greg k-h

ok, Thanks!

I guess that the problem would have been seen by just compiling make foo/bar/file.o?

Yup! works for me and my poor old CPU :-D Thanks!

Quoted 1 line

julia

Signature · 2 lines
Kind Regards,
Aya Saif El-yazal Mahfouz
#11 lore raw
Quoted 10 lines · On Friday 27 February 2015 07:53:49 Aya Mahfouz wrote:
Quoted 9 lines · Julia Lawall
Quoted 9 lines
Quoted 9 lines

It's usually just easiest to build the whole tree, you can do it quicker by doing:
make -j16

replace the number with 2x the number of cpus you have, and you should be fine.

good luck,

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

greg k-h

ok, Thanks!

I guess that the problem would have been seen by just compiling make foo/bar/file.o?

Yup! works for me and my poor old CPU Thanks!

It's also what I normally do, or for the whole directory

make foo/bar/

which will build all files that are turned on in the configuration. Using 'make foo/bar/file.o' will try to build that one file even if it is disabled in the configuration, which may or may not be what you want. The advantage is that you don't have to figure out how to enable it, but the downside is that it may fail to build in your current configuration because of some other configuration option rather than something you did.

Arnd

#12 lore raw
Quoted 24 lines · Arnd Bergmann
Quoted 10 lines · On Friday 27 February 2015 07:53:49 Aya Mahfouz wrote:
Quoted 9 lines · Julia Lawall
Quoted 9 lines
Quoted 9 lines

It's usually just easiest to build the whole tree, you can do it quicker by doing:
make -j16

replace the number with 2x the number of cpus you have, and you should be fine.

good luck,

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

greg k-h

ok, Thanks!

I guess that the problem would have been seen by just compiling make foo/bar/file.o?

Yup! works for me and my poor old CPU Thanks!

It's also what I normally do, or for the whole directory

make foo/bar/

Quoted 8 lines

which will build all files that are turned on in the configuration. Using 'make foo/bar/file.o' will try to build that one file even if it is disabled in the configuration, which may or may not be what you want. The advantage is that you don't have to figure out how to enable it, but the downside is that it may fail to build in your current configuration because of some other configuration option rather than something you did.

Thanks Arnd! Yeah, I usually see that some symbols cannot be enabled unless their dependencies are enabled too.

Quoted 1 line

Arnd

Signature · 2 lines
Kind Regards,
Aya Saif El-yazal Mahfouz