Skip to contentSkip to conversation

af_irda.c comparison fix

PATCH New O.Sezer 1 participant 1 message Aug 13, 2004 Networking

lore
Share & tools
lore

O.Sezer

author
#0 lore raw

PATCH 1/1 af_irda.c comparison fix

From 2.6, cures compiler warnings.

Özkan Sezer

net/irda/af_irda.c +4 -5
@@ -1900,11 +1900,10 @@
 		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 */