OSDN Git Service

crypto: af_alg - fix possible uninit-value in alg_bind()
[android-x86/kernel.git] / crypto / af_alg.c
index ca50eeb..b5953f1 100644 (file)
@@ -157,16 +157,16 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
        void *private;
        int err;
 
-       /* If caller uses non-allowed flag, return error. */
-       if ((sa->salg_feat & ~allowed) || (sa->salg_mask & ~allowed))
-               return -EINVAL;
-
        if (sock->state == SS_CONNECTED)
                return -EINVAL;
 
        if (addr_len != sizeof(*sa))
                return -EINVAL;
 
+       /* If caller uses non-allowed flag, return error. */
+       if ((sa->salg_feat & ~allowed) || (sa->salg_mask & ~allowed))
+               return -EINVAL;
+
        sa->salg_type[sizeof(sa->salg_type) - 1] = 0;
        sa->salg_name[sizeof(sa->salg_name) - 1] = 0;