mirror of
https://github.com/torvalds/linux.git
synced 2026-05-12 16:18:45 +02:00
apparmor: Remove redundant if check in sk_peer_get_label
Remove the redundant if check in sk_peer_get_label() and return ERR_PTR(-ENOPROTOOPT) directly. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
parent
46401cc99c
commit
e6a522c5b4
|
|
@ -1523,15 +1523,11 @@ static int apparmor_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)
|
|||
static struct aa_label *sk_peer_get_label(struct sock *sk)
|
||||
{
|
||||
struct aa_sk_ctx *ctx = aa_sock(sk);
|
||||
struct aa_label *label = ERR_PTR(-ENOPROTOOPT);
|
||||
|
||||
if (rcu_access_pointer(ctx->peer))
|
||||
return aa_get_label_rcu(&ctx->peer);
|
||||
|
||||
if (sk->sk_family != PF_UNIX)
|
||||
return ERR_PTR(-ENOPROTOOPT);
|
||||
|
||||
return label;
|
||||
return ERR_PTR(-ENOPROTOOPT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user