diff --git a/include/linux/cred.h b/include/linux/cred.h
index 4fa9996963109dcc44edcfda3cce8100dd48f29e..b3c76e815d660631aebed8444fce0f93ef8a2c02 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -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);
 }
 
 /**