Skip to content

Commit

Permalink
CRED: Restore const to current_cred()
Browse files Browse the repository at this point in the history
Commit 3295514 ("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 <[email protected]>
Reviewed-by: Paul E. McKenney <[email protected]>
cc: Al Viro <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
dhowells authored and torvalds committed Aug 8, 2011
1 parent 322a8b0 commit 27e4e43
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/linux/cred.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 **)&current->cred)
rcu_dereference_protected(current->cred, 1)

/**
* __task_cred - Access a task's objective credentials
Expand Down

0 comments on commit 27e4e43

Please sign in to comment.