[PATCH] CRED: fix compilation warning in function 'get_cred'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix to following warning by introducing a temporary variable:

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

Signed-off-by: Hannes Eder <hannes@xxxxxxxxxxxxxx>
---
With -O2 the same code as for the original function is generated.

 include/linux/cred.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/include/linux/cred.h b/include/linux/cred.h
index 26c1ab1..2ab8cf7 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -184,7 +184,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 *non_const_cred = (struct cred *) cred;
+	return get_new_cred(non_const_cred);
 }

 /**
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux