From: David Howells Date: Mon, 8 Aug 2011 14:54:53 +0000 (+0100) Subject: CRED: Restore const to current_cred() X-Git-Tag: MMI-PSA29.97-13-9~18612 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=27e4e4362756a78b15e83ef104c8bbe257f40f90;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git CRED: Restore const to current_cred() Commit 3295514841c2 ("fix rcu annotations noise in cred.h") accidentally dropped the const of current->cred inside current_cred() by the insertion of a cast to deal with an RCU annotation loss warning from sparce. Use an appropriate RCU wrapper instead so as not to lose the const. Signed-off-by: David Howells Reviewed-by: Paul E. McKenney cc: Al Viro Signed-off-by: Linus Torvalds --- diff --git a/include/linux/cred.h b/include/linux/cred.h index 98f46efbe2d2..8e2fd44eb160 100644 --- a/include/linux/cred.h +++ b/include/linux/cred.h @@ -269,7 +269,7 @@ static inline void put_cred(const struct cred *_cred) * since nobody else can modify it. */ #define current_cred() \ - (*(__force struct cred **)¤t->cred) + rcu_dereference_protected(current->cred, 1) /** * __task_cred - Access a task's objective credentials