public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Miguel Botón" <mboton.lkml@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] fix "passing argument # of '__memcpy' discards qualifiers from pointer target type" warnings
Date: Wed, 24 Oct 2007 16:39:46 +0200	[thread overview]
Message-ID: <200710241639.46986.mboton.lkml@gmail.com> (raw)

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.000000000 +0200
+++ linux-2.6.24-rc1/fs/cifs/dir.c	2007-10-24 15:49:44.000000000 +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.c	2007-10-24 16:06:43.000000000 +0200
+++ linux-2.6.24-rc1/fs/jfs/namei.c	2007-10-24 15:40:34.000000000 +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.000000000 +0200
+++ linux-2.6.24-rc1/fs/smbfs/cache.c	2007-10-24 16:01:46.000000000 +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.000000000 +0200
+++ linux-2.6.24-rc1/include/asm-x86/io_32.h	2007-10-24 15:56:42.000000000 
+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

             reply	other threads:[~2007-10-24 14:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-24 14:39 Miguel Botón [this message]
     [not found] <9hPIG-7In-19@gated-at.bofh.it>
2007-10-24 15:25 ` [PATCH] fix "passing argument # of '__memcpy' discards qualifiers from pointer target type" warnings Bodo Eggert
2007-10-24 20:35   ` linux-os (Dick Johnson)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200710241639.46986.mboton.lkml@gmail.com \
    --to=mboton.lkml@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox