Skip to content

Commit

Permalink
af_unix: preserve const qualifier in unix_sk()
Browse files Browse the repository at this point in the history
We can change unix_sk() to propagate its argument const qualifier,
thanks to container_of_const().

We need to change dump_common_audit_data() 'struct unix_sock *u'
local var to get a const attribute.

Signed-off-by: Eric Dumazet <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Eric Dumazet authored and davem330 committed Mar 18, 2023
1 parent ae6084b commit b064ba9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions include/net/af_unix.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,7 @@ struct unix_sock {
#endif
};

static inline struct unix_sock *unix_sk(const struct sock *sk)
{
return (struct unix_sock *)sk;
}
#define unix_sk(ptr) container_of_const(ptr, struct unix_sock, sk)

#define peer_wait peer_wq.wait

Expand Down
2 changes: 1 addition & 1 deletion security/lsm_audit.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ static void dump_common_audit_data(struct audit_buffer *ab,
case LSM_AUDIT_DATA_NET:
if (a->u.net->sk) {
const struct sock *sk = a->u.net->sk;
struct unix_sock *u;
const struct unix_sock *u;
struct unix_address *addr;
int len = 0;
char *p = NULL;
Expand Down

0 comments on commit b064ba9

Please sign in to comment.