net/x25: fix incorrect parameter validation in the x25_getsockopt() function
[linux-2.6-microblaze.git] / net / x25 / af_x25.c
index f7a7c77..d18d514 100644 (file)
@@ -460,12 +460,12 @@ static int x25_getsockopt(struct socket *sock, int level, int optname,
        if (get_user(len, optlen))
                goto out;
 
-       len = min_t(unsigned int, len, sizeof(int));
-
        rc = -EINVAL;
        if (len < 0)
                goto out;
 
+       len = min_t(unsigned int, len, sizeof(int));
+
        rc = -EFAULT;
        if (put_user(len, optlen))
                goto out;