Skip to contentSkip to conversation

gcc warning fix

PATCH New Jean Tourrilhes 1 participant 1 message Jan 8, 2004 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gcc warning fix

ir2609_afirda_max_string.diff :
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
o [FEATURE] Fix a gcc warning

net/irda/af_irda.c renamed from net/irda/af_irda.d5.c +4 -5
diff -u -p linux/net/irda/af_irda.d5.c linux/net/irda/af_irda.c
@@ -1890,11 +1890,10 @@ static int irda_setsockopt(struct socket
 		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 */