Skip to contentSkip to conversation

fix "passing argument # of '__memcpy' discards qualifiers from pointer target type" warnings

PATCH Bodo Eggert 2 participants 2 messages Oct 24, 2007 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 13 lines · Miguel Botón

This patch fixes the warnings "passing argument 1 of '__memcpy' discards qualifiers from pointer target type" and "passing argument 2 of '__memcpy' discards qualifiers from pointer target type" when compiling some files.

I don't really know if this is the best way but at least I don't get more warnings.

+++ linux-2.6.24-rc1/fs/cifs/dir.c 2007-10-24 15:49:44.000000000 +0200

(quoted diff) +1 -0
@@ -585,6 +585,7 @@
 
+     unsigned char *dstname = (unsigned char *)a->name;
 

Review line 595

Quoted 3 lines
(quoted diff) +1 -1
@@ -593,7 +594,7 @@
 
-             memcpy((unsigned char *)a->name, b->name, a->len);
+             memcpy(dstname, b->name, a->len);

This looks like a compiler bug. Get the gcc people to fix it.

Signature · 4 lines
Top 100 things you don't want the sysadmin to say:
20. ...and if we just swap these two disc controllers like _this_...

Friß, Spammer: [email protected] [email protected]
#2 lore raw
Quoted 12 lines · Bodo Eggert
Quoted 9 lines · Miguel Botón

This patch fixes the warnings "passing argument 1 of '__memcpy' discards qualifiers from pointer target type" and "passing argument 2 of '__memcpy' discards qualifiers from pointer target type" when compiling some files.

I don't really know if this is the best way but at least I don't get more warnings.

+++ linux-2.6.24-rc1/fs/cifs/dir.c 2007-10-24 15:49:44.000000000 +0200

(quoted diff) +0 -0
@@ -585,6 +585,7 @@
Quoted 14 lines

Review line 595

Quoted 6 lines
(quoted diff) +2 -1
+     unsigned char *dstname = (unsigned char *)a->name;
 
@@ -593,7 +594,7 @@
 
-             memcpy((unsigned char *)a->name, b->name, a->len);
+             memcpy(dstname, b->name, a->len);

This looks like a compiler bug. Get the gcc people to fix it.

Signature · 5 lines
Top 100 things you don't want the sysadmin to say:
20. ...and if we just swap these two disc controllers like _this_...

Friß, Spammer: [email protected] [email protected]
-

According to the header, the pointer is a (const struct qstr *). Not a gcc bug if somebody is writing there. Probably the header needs fixing.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.16.24 on an i686 machine (5592.59 BogoMips). My book : http://www.AbominableFirebug.com/
_

****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to [email protected] - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.