]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Fix sign handling bugs in tun
authorAndrew Morton <akpm@digeo.com>
Sat, 14 Jun 2003 14:22:49 +0000 (07:22 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Sat, 14 Jun 2003 14:22:49 +0000 (07:22 -0700)
From: Ravikiran G Thirumalai <kiran@in.ibm.com>

Fix a check for underflow.

drivers/net/tun.c

index 352cdf3c171613f74209da1b70d5b803723141fc..972cfb0cba60f3e839b9076e97c17c4ecd4543bc 100644 (file)
@@ -179,7 +179,7 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv,
        size_t len = count;
 
        if (!(tun->flags & TUN_NO_PI)) {
-               if ((len -= sizeof(pi)) < 0)
+               if ((len -= sizeof(pi)) > len)
                        return -EINVAL;
 
                memcpy_fromiovec((void *)&pi, iv, sizeof(pi));