include/linux/cred.h: work around gcc-4.2.4 warning in get_cred()
authorPaul Menage <menage@google.com>
Fri, 17 Jul 2009 23:16:18 +0000 (16:16 -0700)
committerJames Morris <jmorris@namei.org>
Sun, 19 Jul 2009 22:45:25 +0000 (08:45 +1000)
With gcc 4.2.4 (building UML) I get the warning

include/linux/cred.h: In function 'get_cred':
include/linux/cred.h:189: warning: passing argument 1 of
'get_new_cred' discards qualifiers from pointer target type

Inserting an additional local variable appears to keep the compiler happy,
although it's not clear to me why this should be needed.

Signed-off-by: Paul Menage <menage@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: James Morris <jmorris@namei.org>
include/linux/cred.h

index 4fa9996963109dcc44edcfda3cce8100dd48f29e..b3c76e815d660631aebed8444fce0f93ef8a2c02 100644 (file)
@@ -186,7 +186,8 @@ static inline struct cred *get_new_cred(struct cred *cred)
  */
 static inline const struct cred *get_cred(const struct cred *cred)
 {
-       return get_new_cred((struct cred *) cred);
+       struct cred *nonconst_cred = (struct cred *) cred;
+       return get_new_cred(nonconst_cred);
 }
 
 /**