Re: [PATCH] fix "passing argument # of '__memcpy' discards qualifiers from pointer target type" warnings

2007-10-24 Thread linux-os (Dick Johnson)

On Wed, 24 Oct 2007, Bodo Eggert wrote:

> Miguel Botón <[EMAIL PROTECTED]> wrote:
>
>> 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.c2007-10-24 15:49:44.0 +0200
>> @@ -585,6 +585,7 @@
>
>> + 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.
> -- 
> 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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] fix "passing argument # of '__memcpy' discards qualifiers from pointer target type" warnings

2007-10-24 Thread Bodo Eggert
Miguel Botón <[EMAIL PROTECTED]> wrote:

> 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.c2007-10-24 15:49:44.0 +0200
> @@ -585,6 +585,7 @@

> + 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.
-- 
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]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2007-10-24 Thread 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.


diff -ruN linux-2.6.24-rc1.orig/fs/cifs/dir.c linux-2.6.24-rc1/fs/cifs/dir.c
--- linux-2.6.24-rc1.orig/fs/cifs/dir.c 2007-10-24 16:06:42.0 +0200
+++ linux-2.6.24-rc1/fs/cifs/dir.c  2007-10-24 15:49:44.0 +0200
@@ -585,6 +585,7 @@
   struct qstr *b)
 {
struct nls_table *codepage = CIFS_SB(dentry->d_inode->i_sb)->local_nls;
+   unsigned char *dstname = (unsigned char *)a->name;
 
if ((a->len == b->len) &&
(nls_strnicmp(codepage, a->name, b->name, a->len) == 0)) {
@@ -593,7 +594,7 @@
 * case take precedence.  If a is not a negative dentry, this
 * should have no side effects
 */
-   memcpy((unsigned char *)a->name, b->name, a->len);
+   memcpy(dstname, b->name, a->len);
return 0;
}
return 1;
diff -ruN linux-2.6.24-rc1.orig/fs/jfs/namei.c linux-2.6.24-rc1/fs/jfs/namei.c
--- linux-2.6.24-rc1.orig/fs/jfs/namei.c2007-10-24 16:06:43.0 
+0200
+++ linux-2.6.24-rc1/fs/jfs/namei.c 2007-10-24 15:40:34.0 +0200
@@ -1580,6 +1580,7 @@
 
 static int jfs_ci_compare(struct dentry *dir, struct qstr *a, struct qstr *b)
 {
+   unsigned char *dstname = (unsigned char *)a->name;
int i, result = 1;
 
if (a->len != b->len)
@@ -1597,7 +1598,7 @@
 * dentry, we blindly replace it with b.  This should be harmless if
 * a is not a negative dentry.
 */
-   memcpy((unsigned char *)a->name, b->name, a->len);
+   memcpy(dstname, b->name, a->len);
 out:
return result;
 }
diff -ruN linux-2.6.24-rc1.orig/fs/smbfs/cache.c 
linux-2.6.24-rc1/fs/smbfs/cache.c
--- linux-2.6.24-rc1.orig/fs/smbfs/cache.c  2007-10-09 22:31:38.0 
+0200
+++ linux-2.6.24-rc1/fs/smbfs/cache.c   2007-10-24 16:01:46.0 +0200
@@ -145,9 +145,10 @@
if (!newdent)
goto end_advance;
} else {
+   char *dstname = (char *)newdent->d_name.name;
+
hashed = 1;
-   memcpy((char *) newdent->d_name.name, qname->name,
-  newdent->d_name.len);
+   memcpy(dstname, qname->name, newdent->d_name.len);
}
 
if (!newdent->d_inode) {
diff -ruN linux-2.6.24-rc1.orig/include/asm-x86/io_32.h 
linux-2.6.24-rc1/include/asm-x86/io_32.h
--- linux-2.6.24-rc1.orig/include/asm-x86/io_32.h   2007-10-24 
16:06:45.0 +0200
+++ linux-2.6.24-rc1/include/asm-x86/io_32.h2007-10-24 15:56:42.0 
+0200
@@ -208,7 +208,8 @@
 static inline void
 memcpy_fromio(void *dst, const volatile void __iomem *src, int count)
 {
-   __memcpy(dst, (const void __force *)src, count);
+   const void __force *src1 = (const void __force *)src;
+   __memcpy(dst, src1, count);
 }
 
 static inline void

-- 
Miguel Botón
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/