]> git.hungrycats.org Git - linux/commitdiff
[IRDA]: Fix compiler warning in af_irda.c
authorJean Tourrilhes <jt@bougret.hpl.hp.com>
Thu, 8 Jan 2004 18:11:04 +0000 (10:11 -0800)
committerStephen Hemminger <shemminger@osdl.org>
Thu, 8 Jan 2004 18:11:04 +0000 (10:11 -0800)
net/irda/af_irda.c

index c5dee17a2629e6136398f9f398857fe9cc072e06..86bc800c26e0e5b3e0a912a88ea97246c3d22992 100644 (file)
@@ -1891,11 +1891,10 @@ static int irda_setsockopt(struct socket *sock, int level, int optname,
                case IAS_STRING:
                        /* Should check charset & co */
                        /* Check length */
-                       if(ias_opt->attribute.irda_attrib_string.len >
-                          IAS_MAX_STRING) {
-                               kfree(ias_opt);
-                               return -EINVAL;
-                       }
+                       /* The length is encoded in a __u8, and
+                        * IAS_MAX_STRING == 256, so there is no way
+                        * userspace can pass us a string too large.
+                        * Jean II */
                        /* NULL terminate the string (avoid troubles) */
                        ias_opt->attribute.irda_attrib_string.string[ias_opt->attribute.irda_attrib_string.len] = '\0';
                        /* Add a string attribute */