Skip to contentSkip to conversation

Remove bogus memcpy in brcm80211 ai_detach

PATCH In review Andi Kleen 2 participants 4 messages Sep 3, 2012 Networking drivers (wireless)

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 Remove bogus memcpy in brcm80211 ai_detach

gcc 4.8 warns for this memcpy. While the copy size is correct, the whole copy seems to be a nop because the destination is never used, and there's no need to use memcpy to copy pointers anyways. And the type of the pointer was wrong, but at least those are always the same.

Just remove it.

/backup/lsrc/git/linux-lto-2.6/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c: In function 'ai_detach':
/backup/lsrc/git/linux-lto-2.6/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c:539:32: warning: argument to 'sizeof' in 'memcpy' call is the same pointer type 'struct si_pub **' as the destination; expected 'struct si_pub *' or an explicit length [-Wsizeof-pointer-memaccess]

  memcpy(&si_local, &sih, sizeof(struct si_pub **));
                                ^
drivers/net/wireless/brcm80211/brcmsmac/aiutils.c +0 -3
index 8c9345d..b89f127 100644
@@ -535,9 +535,6 @@ void ai_detach(struct si_pub *sih)
 {
 	struct si_info *sii;
 
-	struct si_pub *si_local = NULL;
-	memcpy(&si_local, &sih, sizeof(struct si_pub **));
-
 	sii = container_of(sih, struct si_info, pub);
 
 	if (sii == NULL)
Signature · 1 line
[email protected] -- Speaking for myself only.
#1 lore raw
Quoted 6 lines · Andi Kleen

gcc 4.8 warns for this memcpy. While the copy size is correct, the whole copy seems to be a nop because the destination is never used, and there's no need to use memcpy to copy pointers anyways. And the type of the pointer was wrong, but at least those are always the same.

Just remove it.

Andi,

Have you compiled all of wireless with gcc 4.8? If so, can I assume that you will report warnings for other drivers?

Thanks,

Larry

author
#2 lore raw
Quoted 6 lines · Larry Finger
Quoted 5 lines · Andi Kleen

gcc 4.8 warns for this memcpy. While the copy size is correct, the whole copy seems to be a nop because the destination is never used, and there's no need to use memcpy to copy pointers anyways. And the type of the pointer was wrong, but at least those are always the same.

Quoted 6 lines
Quoted 1 line

Just remove it.

Andi,

Have you compiled all of wireless with gcc 4.8? If so, can I assume that you will report warnings for other drivers?

I did 64bit allyesconfig with LTO yes. wireless has very few warnings overall, compared to many other subsystems.

I found one other issue in it for which I'm sending a patch.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
#3 lore raw
Quoted 9 lines · Andi Kleen
Quoted 2 lines · Larry Finger

Have you compiled all of wireless with gcc 4.8? If so, can I assume that you will report warnings for other drivers?

I did 64bit allyesconfig with LTO yes. wireless has very few warnings overall, compared to many other subsystems.

I found one other issue in it for which I'm sending a patch.

Thanks for responding, and for doing the cleanup.

Larry