mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2.6 IrDA] gcc warning fix
@ 2004-01-08  2:35 Jean Tourrilhes
  0 siblings, 0 replies; only message in thread
From: Jean Tourrilhes @ 2004-01-08  2:35 UTC (permalink / raw)
  To: David S. Miller, Linux kernel mailing list

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


diff -u -p linux/net/irda/af_irda.d5.c linux/net/irda/af_irda.c
--- linux/net/irda/af_irda.d5.c	Wed Nov 19 16:21:42 2003
+++ linux/net/irda/af_irda.c	Wed Nov 19 16:26:04 2003
@@ -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 */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-01-08  2:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-08  2:35 [PATCH 2.6 IrDA] gcc warning fix Jean Tourrilhes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®