提交 da49b5da 编写于 作者: V Vasyl Gomonovych 提交者: Casey Schaufler

Smack: fix dereferenced before check

This patch fixes the warning reported by smatch:
security/smack/smack_lsm.c:2872 smack_socket_connect() warn:
variable dereferenced before check 'sock->sk' (see line 2869)
Signed-off-by: NVasyl Gomonovych <gomonovych@gmail.com>
Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
上级 d21bd689
...@@ -2866,12 +2866,16 @@ static int smack_socket_connect(struct socket *sock, struct sockaddr *sap, ...@@ -2866,12 +2866,16 @@ static int smack_socket_connect(struct socket *sock, struct sockaddr *sap,
#endif #endif
#ifdef SMACK_IPV6_SECMARK_LABELING #ifdef SMACK_IPV6_SECMARK_LABELING
struct smack_known *rsp; struct smack_known *rsp;
struct socket_smack *ssp = sock->sk->sk_security; struct socket_smack *ssp;
#endif #endif
if (sock->sk == NULL) if (sock->sk == NULL)
return 0; return 0;
#ifdef SMACK_IPV6_SECMARK_LABELING
ssp = sock->sk->sk_security;
#endif
switch (sock->sk->sk_family) { switch (sock->sk->sk_family) {
case PF_INET: case PF_INET:
if (addrlen < sizeof(struct sockaddr_in)) if (addrlen < sizeof(struct sockaddr_in))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册