Smack: fix dereferenced before check
Subsystems (2)
PATCH 1/1 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)
--- security/smack/smack_lsm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
security/smack/smack_lsm.c +5 -1
@@ -2866,12 +2866,16 @@ static int smack_socket_connect(struct socket *sock, struct sockaddr *sap,#endif #ifdef SMACK_IPV6_SECMARK_LABELING struct smack_known *rsp; -struct socket_smack *ssp = sock->sk->sk_security; +struct socket_smack *ssp;#endif if (sock->sk ==NULL )return 0 ; +#ifdef SMACK_IPV6_SECMARK_LABELING + ssp = sock->sk->sk_security; +#endif +switch (sock->sk->sk_family) {case PF_INET :if (addrlen <sizeof (struct sockaddr_in ))
Signature · 6 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info@ http://vger.kernel.org/majordomo-info.html
Quoted 5 lines · Vasyl Gomonovych
This patch fixes the warning reported by smatch:
security/smack/smack_lsm.c:2872smack_socket_connect()warn:
variable dereferenced before check 'sock->sk' (see line 2869)Signed-off-by Vasyl Gomonovych <[email protected]>
Looks obviously correct - thanks.
Quoted 28 lines
--- security/smack/smack_lsm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)security/smack/smack_lsm.c +5
-1@@ -2866,12 +2866,16 @@ static int smack_socket_connect(struct socket *sock, struct sockaddr *sap,#endif #ifdef SMACK_IPV6_SECMARK_LABELING struct smack_known *rsp; -struct socket_smack *ssp = sock->sk->sk_security; +struct socket_smack *ssp;#endif if (sock->sk ==NULL )return 0 ; +#ifdef SMACK_IPV6_SECMARK_LABELING + ssp = sock->sk->sk_security; +#endif +switch (sock->sk->sk_family) {case PF_INET :if (addrlen <sizeof (struct sockaddr_in ))Signature · 1 line
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 5 lines · Vasyl Gomonovych
This patch fixes the warning reported by smatch:
security/smack/smack_lsm.c:2872smack_socket_connect()warn:
variable dereferenced before check 'sock->sk' (see line 2869)Signed-off-by Vasyl Gomonovych <[email protected]>
I will take this into the Smack tree. Thank you.
Quoted 16 lines
--- security/smack/smack_lsm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)security/smack/smack_lsm.c +1
-1@@ -2866,12 +2866,16 @@ static int smack_socket_connect(struct socket *sock, struct sockaddr *sap,#endif #ifdef SMACK_IPV6_SECMARK_LABELING struct smack_known *rsp; -struct socket_smack *ssp = sock->sk->sk_security; +struct socket_smack *ssp;#endif
security/smack/smack_lsm.c static int smack_socket_connect(struct socket *sock, struct sockaddr *sap, · line 2881
Quoted 10 lines
security/smack/smack_lsm.c +4
-0if (sock->sk ==NULL )return 0 ; +#ifdef SMACK_IPV6_SECMARK_LABELING + ssp = sock->sk->sk_security; +#endif +switch (sock->sk->sk_family) {case PF_INET :if (addrlen <sizeof (struct sockaddr_in ))
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org
More majordomo info@ http://vger.kernel.org/majordomo-info.html