security/smack: Use AF_INET for sin_family field
authorJulia Lawall <julia@diku.dk>
Wed, 5 Aug 2009 12:34:55 +0000 (14:34 +0200)
committerJames Morris <jmorris@namei.org>
Wed, 5 Aug 2009 22:46:15 +0000 (08:46 +1000)
Elsewhere the sin_family field holds a value with a name of the form
AF_..., so it seems reasonable to do so here as well.  Also the values of
PF_INET and AF_INET are the same.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
struct sockaddr_in sip;
@@

(
sip.sin_family ==
- PF_INET
+ AF_INET
|
sip.sin_family !=
- PF_INET
+ AF_INET
|
sip.sin_family =
- PF_INET
+ AF_INET
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: James Morris <jmorris@namei.org>
security/smack/smack_lsm.c

index 1c9bdbcbe3d2bfbd7c3f83b10c19800c0d7b929e..c243a2b25832acf9db5c226862238203d8a41c68 100644 (file)
@@ -2464,7 +2464,7 @@ static int smack_socket_sendmsg(struct socket *sock, struct msghdr *msg,
        /*
         * Perfectly reasonable for this to be NULL
         */
-       if (sip == NULL || sip->sin_family != PF_INET)
+       if (sip == NULL || sip->sin_family != AF_INET)
                return 0;
 
        return smack_netlabel_send(sock->sk, sip);