diff mbox series

[next] security: smack: fix sap undeclared error in smack_socket_sendmsg

Message ID 20190509124628.189228-1-wangkefeng.wang@huawei.com (mailing list archive)
State New, archived
Headers show
Series [next] security: smack: fix sap undeclared error in smack_socket_sendmsg | expand

Commit Message

Kefeng Wang May 9, 2019, 12:46 p.m. UTC
If CONFIG_IPV6 is disabled, there is build error, fix it.

security/smack/smack_lsm.c: In function ‘smack_socket_sendmsg’:
security/smack/smack_lsm.c:3698:7: error: ‘sap’ undeclared (first use in this function)
     sap->sin6_family != AF_INET6)

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 security/smack/smack_lsm.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Casey Schaufler May 9, 2019, 3:29 p.m. UTC | #1
On 5/9/2019 5:46 AM, Kefeng Wang wrote:
> If CONFIG_IPV6 is disabled, there is build error, fix it.
>
> security/smack/smack_lsm.c: In function ‘smack_socket_sendmsg’:
> security/smack/smack_lsm.c:3698:7: error: ‘sap’ undeclared (first use in this function)
>       sap->sin6_family != AF_INET6)
>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>

Thank you for your patch. This has already been fixed and
will be in 5.2 when James sends the pull request.

> ---
>   security/smack/smack_lsm.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
> index b5b333d72637..ff5b7dc6816f 100644
> --- a/security/smack/smack_lsm.c
> +++ b/security/smack/smack_lsm.c
> @@ -3693,6 +3693,7 @@ static int smack_socket_sendmsg(struct socket *sock, struct msghdr *msg,
>   			return -EINVAL;
>   		rc = smack_netlabel_send(sock->sk, sip);
>   		break;
> +#if IS_ENABLED(CONFIG_IPV6)
>   	case AF_INET6:
>   		if (msg->msg_namelen < SIN6_LEN_RFC2133 ||
>   		    sap->sin6_family != AF_INET6)
> @@ -3707,6 +3708,7 @@ static int smack_socket_sendmsg(struct socket *sock, struct msghdr *msg,
>   		rc = smk_ipv6_port_check(sock->sk, sap, SMK_SENDING);
>   #endif
>   		break;
> +#endif
>   	}
>   	return rc;
>   }
Kefeng Wang May 10, 2019, 1:01 a.m. UTC | #2
On 2019/5/9 23:29, Casey Schaufler wrote:
> On 5/9/2019 5:46 AM, Kefeng Wang wrote:
>> If CONFIG_IPV6 is disabled, there is build error, fix it.
>>
>> security/smack/smack_lsm.c: In function ‘smack_socket_sendmsg’:
>> security/smack/smack_lsm.c:3698:7: error: ‘sap’ undeclared (first use in this function)
>>       sap->sin6_family != AF_INET6)
>>
>> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
>
> Thank you for your patch. This has already been fixed and
> will be in 5.2 when James sends the pull request.
ok ; )
>
>> ---
>>   security/smack/smack_lsm.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
>> index b5b333d72637..ff5b7dc6816f 100644
>> --- a/security/smack/smack_lsm.c
>> +++ b/security/smack/smack_lsm.c
>> @@ -3693,6 +3693,7 @@ static int smack_socket_sendmsg(struct socket *sock, struct msghdr *msg,
>>               return -EINVAL;
>>           rc = smack_netlabel_send(sock->sk, sip);
>>           break;
>> +#if IS_ENABLED(CONFIG_IPV6)
>>       case AF_INET6:
>>           if (msg->msg_namelen < SIN6_LEN_RFC2133 ||
>>               sap->sin6_family != AF_INET6)
>> @@ -3707,6 +3708,7 @@ static int smack_socket_sendmsg(struct socket *sock, struct msghdr *msg,
>>           rc = smk_ipv6_port_check(sock->sk, sap, SMK_SENDING);
>>   #endif
>>           break;
>> +#endif
>>       }
>>       return rc;
>>   }
>
>
diff mbox series

Patch

diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index b5b333d72637..ff5b7dc6816f 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -3693,6 +3693,7 @@  static int smack_socket_sendmsg(struct socket *sock, struct msghdr *msg,
 			return -EINVAL;
 		rc = smack_netlabel_send(sock->sk, sip);
 		break;
+#if IS_ENABLED(CONFIG_IPV6)
 	case AF_INET6:
 		if (msg->msg_namelen < SIN6_LEN_RFC2133 ||
 		    sap->sin6_family != AF_INET6)
@@ -3707,6 +3708,7 @@  static int smack_socket_sendmsg(struct socket *sock, struct msghdr *msg,
 		rc = smk_ipv6_port_check(sock->sk, sap, SMK_SENDING);
 #endif
 		break;
+#endif
 	}
 	return rc;
 }